Commit de9aadfc authored by Elouan Martinet's avatar Elouan Martinet
Browse files

merge 3.29.4 into 3.30

--HG--
branch : 3.30
Pipeline #64164 passed with stages
in 32 minutes and 37 seconds
......@@ -673,14 +673,17 @@ e731c31eaed06ac0a781db4d9a36d8b3732a4852 debian/3.27.2-1
f2e07e9cc36753c9bb21030a05a6d715aa33a289 3.27.4
7e69862f2332df296950afa7d4943471dec01986 3.27.5
7b332e2e0287182c6e9283b7debf4eb7233d3bad 3.27.6
c517d3f941b484cd0c81b81891a7d50d0ed6f10b 3.27.7
695832965852f2a8d6c767dab0f74903c962feb8 3.28.0rc1
2c0ecdfda9c46f95ef514efa0c9c06c96c98b4bd 3.28.0
4b2725c4066a0015afa66267dea3bd392235194d 3.28.1
152838b95709e95297996583a7f1a20262453970 3.28.2
0b6a5ea3950bcb3bc50b38e7d7288e3b59a7cb1a 3.28.3
f9d1400d311fb123aa5ce69a3d36742550441646 3.28.4
a20956da474443f84cee8f41e8d7e88683a4c124 3.28.5
08e8654133c1f0c44d96da36e054347c22d30c9d 3.29.0
54ddcc997e1cfb7f8701e226fb88128737898c0b 3.29.1
7ddad2aa6426aa73c09cc8232ecbe0f11bfd5d9c 3.29.2
f5768f140cde2e522be7c14ec180e87865890743 3.29.3
2052a708e92d598936cc84b8eb1030281283d2fc 3.29.4
bedf6cb540ca4dd0b099ce3c6b00e1202d48168a 3.30.0
from __future__ import absolute_import
import markdown
import logging
......
from __future__ import print_function
try:
rtype, = __args__
except ValueError:
......
......@@ -57,6 +57,9 @@ class MatchIsEIDPredicate(object):
except ValueError:
return False
if request.cw_cnx is None:
return False
try:
request.cw_cnx.entity_from_eid(eid)
except UnknownEid:
......@@ -82,6 +85,9 @@ class MatchIsETypeAndEIDPredicate(object):
except ValueError:
return False
if request.cw_cnx is None:
return False
try:
entity = request.cw_cnx.entity_from_eid(eid)
except UnknownEid:
......@@ -112,6 +118,9 @@ class HasCWPermissionRoutePredicate:
if not eid:
return False
if request.cw_cnx is None:
return False
try:
entity = request.cw_cnx.entity_from_eid(eid)
except UnknownEid:
......
......@@ -48,11 +48,11 @@ from cubicweb.server import utils, hook, querier, sources
from cubicweb.server.session import InternalManager, Connection
NO_CACHE_RELATIONS = set([
NO_CACHE_RELATIONS = {
('owned_by', 'object'),
('created_by', 'object'),
('cw_source', 'object'),
])
}
def prefill_entity_caches(entity):
......@@ -498,7 +498,7 @@ class Repository(object):
return
with self.internal_cnx() as cnx:
sourceent = cnx.execute(
'Any S, SA, SC WHERE S is_instance_of CWSource,'
'Any S, SA, SC LIMIT 2 WHERE S is_instance_of CWSource,'
' S name "system", S type SA, S config SC'
).one()
self.system_source.eid = sourceent.eid
......
......@@ -230,6 +230,9 @@ class HTMLHeadTC(CubicWebTC):
head.add_js(base_url + u'bob1.js')
head.add_js(u'http://ext.com/bob2.js')
head.add_js(u'http://ext.com/bob3.js')
head.write_front(
'<script type="text/javascript">console.log("FIRST SCRIPT ADDED HERE")</script>\n'
)
head.add_css(base_url + u'bob4.css')
head.add_css(base_url + u'bob5.css')
head.add_css(base_url + u'bob6.css', 'print')
......@@ -238,6 +241,7 @@ class HTMLHeadTC(CubicWebTC):
head.add_ie_css(base_url + u'bob9.css', 'print', u'[if lt IE 7]')
result = head.getvalue()
expected = u"""<head>
<script type="text/javascript">console.log("FIRST SCRIPT ADDED HERE")</script>
<link rel="stylesheet" type="text/css" media="all" href="http://test.fr/data/bob4.css"/>
<link rel="stylesheet" type="text/css" media="all" href="http://test.fr/data/bob5.css"/>
<link rel="stylesheet" type="text/css" media="print" href="http://test.fr/data/bob6.css"/>
......
......@@ -25,6 +25,7 @@ import re
import json
from operator import itemgetter
from inspect import getfullargspec as getargspec
from functools import wraps
from itertools import repeat
from uuid import uuid4
from warnings import warn
......@@ -179,6 +180,20 @@ class RepeatList(object):
self._size -= 1
def handle_writing_constraints(method):
@wraps(method)
def wrapper(self, value):
if self.tracewrites:
from traceback import format_stack
stack = format_stack(None)[:-1]
escaped_stack = xml_escape(json_dumps(u'\n'.join(stack)))
escaped_html = xml_escape(value).replace('\n', '<br/>\n')
tpl = u'<span onclick="alert(%s)">%s</span>'
value = tpl % (escaped_stack, escaped_html)
return method(self, value)
return wrapper
class UStringIO(list):
"""a file wrapper which automatically encode unicode string to an encoding
specifed in the constructor
......@@ -193,16 +208,14 @@ class UStringIO(list):
__nonzero__ = __bool__
@handle_writing_constraints
def write(self, value):
if self.tracewrites:
from traceback import format_stack
stack = format_stack(None)[:-1]
escaped_stack = xml_escape(json_dumps(u'\n'.join(stack)))
escaped_html = xml_escape(value).replace('\n', '<br/>\n')
tpl = u'<span onclick="alert(%s)">%s</span>'
value = tpl % (escaped_stack, escaped_html)
self.append(value)
@handle_writing_constraints
def write_front(self, value):
self.insert(0, value)
def getvalue(self):
return u''.join(self)
......
......@@ -4,6 +4,12 @@ cubicweb (3.30.0-1) unstable; urgency=medium
-- Simon Chabot <simon.chabot@logilab.fr> Tue, 16 Mar 2021 16:28:48 +0100
cubicweb (3.29.4-1) unstable; urgency=medium
* New bugfix release
-- Aurélien Lubert <aurelien.lubert@logilab.fr> Thu, 24 Jun 2021 15:25:42 +0200
cubicweb (3.29.3-1) unstable; urgency=medium
* New upstream release
......@@ -28,6 +34,12 @@ cubicweb (3.29.0-1) unstable; urgency=medium
-- Laurent Peuch <cortex@worlddomination.be> Tue, 08 Dec 2020 14:51:17 +0200
cubicweb (3.28.5-1) unstable; urgency=medium
* New upstream release
-- Nicolas Chauvat <nicolas.chauvat@logilab.fr> Tue, 22 Jun 2021 22:08:18 +0200
cubicweb (3.28.4-1) unstable; urgency=medium
* New upstream release
......@@ -58,6 +70,12 @@ cubicweb (3.28.0-1) unstable; urgency=medium
-- Chabot Simon <schabot@logilab.fr> Wed, 24 Jun 2020 10:17:13 +0200
cubicweb (3.27.7-1) unstable; urgency=medium
* New upstream release
-- Nicolas Chauvat <nicolas.chauvat@logilab.fr> Tue, 22 Jun 2021 20:50:12 +0200
cubicweb (3.27.6-1) unstable; urgency=medium
* New upstream release
......
......@@ -2,10 +2,9 @@ Source: cubicweb
Section: web
Priority: optional
Maintainer: Logilab S.A. <contact@logilab.fr>
Uploaders: Sylvain Thenault <sylvain.thenault@logilab.fr>,
David Douard <david.douard@logilab.fr>,
Uploaders: Nicolas Chauvat <nicolas.chauvat@logilab.fr>,
Build-Depends:
debhelper (>= 9.20160709),
debhelper (>= 12.1.1),
dh-python,
python3-all,
python3-setuptools,
......
......@@ -115,4 +115,3 @@ setup(
zip_safe=False,
python_requires=">=3.6",
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment