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

merge 3.30 into 3.31

--HG--
branch : 3.31
Pipeline #64165 passed with stages
in 38 minutes and 27 seconds
......@@ -673,15 +673,18 @@ 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
f0007241c4773160b6c2b93a0b56a9617a74389c 3.31.1
......@@ -50,6 +50,8 @@ from getpass import getpass
from os.path import basename
from time import clock
from six.moves import input
from logilab.common.fileutils import lines
from logilab.common.ureports import Table, TextWriter
......
from __future__ import absolute_import
import webtest
from cubicweb.wsgi import handler
......
from __future__ import absolute_import
import markdown
import logging
......
from __future__ import print_function
try:
rtype, = __args__
except ValueError:
......
from __future__ import print_function
from base64 import b64decode, b64encode
try:
uri, newdn = __args__
......
......@@ -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"/>
......
......@@ -17,6 +17,7 @@ __pycache__
.pybuild
.cache
.coverage
.pytest-cache
build/
dist/
node_modules/
......
......@@ -17,8 +17,6 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""Some utilities for CubicWeb server/clients."""
from __future__ import division
import base64
import decimal
import datetime
......@@ -27,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
......@@ -181,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
......@@ -195,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)
......
# copyright 2003 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
# contact https://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of CubicWeb.
#
......@@ -14,7 +14,7 @@
# details.
#
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
# with CubicWeb. If not, see <https://www.gnu.org/licenses/>.
"""
.. autoclass:: AutomaticEntityForm
......@@ -730,10 +730,13 @@ class UnrelatedDivs(EntityView):
mode = '%s:%s:%s:%s' % (role, entity.eid, rschema.type, eschema)
url = self._cw.build_url(entity.rest_path(), vid='search-associate',
__mode=mode)
options.append((eschema.display_name(self._cw),
'<option value="%s">%s %s</option>' % (
xml_escape(url), _('Search for'), eschema.display_name(self._cw))))
return [option for _name, option in sorted(options)]
options.append(
(eschema.display_name(self._cw),
'<option value="%s">%s %s</option>' % (
xml_escape(url),
_('Search for'),
eschema.display_name(self._cw))))
return [option for name, option in sorted(options)]
# The automatic entity form ####################################################
......
......@@ -16,6 +16,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
......@@ -40,6 +46,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
......@@ -70,6 +82,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,
......@@ -30,7 +29,7 @@ Build-Depends:
sphinx-common,
Standards-Version: 4.3.0
Homepage: https://www.cubicweb.org
X-Python3-Version: >= 3.6
X-Python3-Version: >= 3.7
Package: python3-cubicweb
......
......@@ -271,7 +271,7 @@ How to import LDAP users in |cubicweb| ?
print 'USAGE: python ldap2system.py <database>'
sys.exit(1)
if raw_input('update %s db ? [y/n]: ' % database).strip().lower().startswith('y'):
if input('update %s db ? [y/n]: ' % database).strip().lower().startswith('y'):
cnx = get_connection(user=getlogin(), database=database)
cursor = cnx.cursor()
......
......@@ -478,8 +478,8 @@ simplify greatly complex security definition and upgrade.
class my_relation(RelationDefinition):
__permissions__ = {'read': ('managers', 'users'),
'add': ('managers', RRQLExpression('U has_update_permission S')),
'delete': ('managers', RRQLExpression('U has_update_permission S'))
}
'delete': ('managers', RRQLExpression('U has_update_permission S')),
}
In the above example, user will be allowed to add/delete `my_relation` if he has
the `update` permission on the subject of the relation.
......
......@@ -123,19 +123,19 @@ attribute and relation. Here is the code to add to :file:`schema.py`:
'add': ('managers',),
'update': ('managers', 'owners',),
'delete': ('managers', 'owners'),
}
}
AUTH_ONLY_PERMISSIONS = {
'read': ('managers', 'users'),
'add': ('managers',),
'update': ('managers', 'owners',),
'delete': ('managers', 'owners'),
}
}
CLASSIFIERS_PERMISSIONS = {
'read': ('managers', 'users', 'guests'),
'add': ('managers',),
'update': ('managers', 'owners',),
'delete': ('managers', 'owners'),
}
}
from cubicweb_folder.schema import Folder
from cubicweb_file.schema import File
......
......@@ -76,8 +76,8 @@ setup(
'filelock',
'rdflib',
'rdflib-jsonld',
'pyramid >= 1.5.0,<2',
'waitress >= 1.4.0,<2',
'pyramid >= 1.5.0, < 2.0.0',
'waitress >= 1.4.0, < 2.0.0',
'wsgicors >= 0.3',
'pyramid_multiauth',
'repoze.lru',
......
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