diff --git a/constraints.txt b/constraints.txt index e422719e96..a49fd8e054 100644 --- a/constraints.txt +++ b/constraints.txt @@ -1,10 +1,10 @@ AccessControl==4.0b7 -Acquisition==4.5 +Acquisition==4.6 AuthEncoding==4.1 BTrees==4.5.1 -Chameleon==3.6 +Chameleon==3.6.1 DateTime==4.3 -DocumentTemplate==3.0b7 +DocumentTemplate==3.0b8 ExtensionClass==4.4 Missing==4.1 MultiMapping==4.1 @@ -82,9 +82,9 @@ zope.site==4.2.2 zope.size==4.3 zope.structuredtext==4.3 zope.tal==4.4 -zope.tales==4.3 +zope.tales==5.0 zope.testbrowser==5.3.2 zope.testing==4.7 -zope.testrunner==4.9.2 +zope.testrunner==5.0 zope.traversing==4.3.1 zope.viewlet==4.2.1 diff --git a/requirements-full.txt b/requirements-full.txt index 4f15b11259..9b804e3cca 100644 --- a/requirements-full.txt +++ b/requirements-full.txt @@ -1,11 +1,11 @@ -e git+https://github.com/zopefoundation/Zope.git@master#egg=Zope AccessControl==4.0b7 -Acquisition==4.5 +Acquisition==4.6 AuthEncoding==4.1 BTrees==4.5.1 -Chameleon==3.6 +Chameleon==3.6.1 DateTime==4.3 -DocumentTemplate==3.0b7 +DocumentTemplate==3.0b8 ExtensionClass==4.4 Missing==4.1 MultiMapping==4.1 @@ -82,9 +82,9 @@ zope.site==4.2.2 zope.size==4.3 zope.structuredtext==4.3 zope.tal==4.4 -zope.tales==4.3 +zope.tales==5.0 zope.testbrowser==5.3.2 zope.testing==4.7 -zope.testrunner==4.9.2 +zope.testrunner==5.0 zope.traversing==4.3.1 zope.viewlet==4.2.1 diff --git a/src/App/dtml/manage_page_footer.dtml b/src/App/dtml/manage_page_footer.dtml index 8c02731cc6..756e8286e6 100644 --- a/src/App/dtml/manage_page_footer.dtml +++ b/src/App/dtml/manage_page_footer.dtml @@ -1,11 +1,13 @@ - - - - + + + + + diff --git a/src/OFS/browser/__init__.py b/src/OFS/browser/__init__.py index 39e26e052d..3727bcca6c 100644 --- a/src/OFS/browser/__init__.py +++ b/src/OFS/browser/__init__.py @@ -11,17 +11,35 @@ # ############################################################################## +from Acquisition import aq_base +from Acquisition import aq_parent from Products.Five import BrowserView +raiser = 'raise_standardErrorMessage' + + class StandardErrorMessageView(BrowserView): """ View rendered on SiteError. - Requires a DTML Method named ``standard_error_message`` + Requires a callable object named ``standard_error_message`` on the + published object's acquisition path. The callable can be a DTML Method, + DTML Document, Python Script or Page Template. """ def __call__(self): - root = self.request['PARENTS'][0] - return root.standard_error_message( + pub = getattr(self.request, 'PUBLISHED', self.request['PARENTS'][0]) + parent = aq_parent(pub) + + if pub is not None and parent is None: + # The published object is not an instance or not wrapped + pub = self.request['PARENTS'][0] + parent = aq_parent(pub) + + if getattr(aq_base(pub), raiser, None) is not None: + return getattr(pub, raiser)(REQUEST=self.request)[1] + + return parent.standard_error_message( + client=parent, error_type=self.context.__class__.__name__, error_value=str(self.context)) diff --git a/src/Products/PageTemplates/tests/testZopePageTemplate.py b/src/Products/PageTemplates/tests/testZopePageTemplate.py index 25ad7e91b1..15e53a8706 100644 --- a/src/Products/PageTemplates/tests/testZopePageTemplate.py +++ b/src/Products/PageTemplates/tests/testZopePageTemplate.py @@ -48,7 +48,7 @@ - + test üöäÜÖÄß diff --git a/src/Products/PageTemplates/tests/test_persistenttemplate.py b/src/Products/PageTemplates/tests/test_persistenttemplate.py index ec641584da..e936425331 100644 --- a/src/Products/PageTemplates/tests/test_persistenttemplate.py +++ b/src/Products/PageTemplates/tests/test_persistenttemplate.py @@ -1,7 +1,9 @@ +import io import re import unittest from Products.PageTemplates.ZopePageTemplate import manage_addPageTemplate +from Testing.utils import capture_stdout from Testing.ZopeTestCase import ZopeTestCase @@ -211,7 +213,10 @@ def test_filename_attribute(self): self.assertEqual(template().strip(), u'012') def test_edit_with_errors(self): - template = self._makeOne('foo', simple_error) + # Prevent error output to the console + with capture_stdout(io.StringIO()): + template = self._makeOne('foo', simple_error) + # this should not raise: editable_text = get_editable_content(template) # and the errors should be in an xml comment at the start of diff --git a/src/Testing/utils.py b/src/Testing/utils.py new file mode 100644 index 0000000000..9e6bdff494 --- /dev/null +++ b/src/Testing/utils.py @@ -0,0 +1,24 @@ +############################################################################## +# +# Copyright (c) 2002 Zope Foundation and Contributors. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE +# +############################################################################## +""" Some utility functiions for unit tests +""" +import contextlib +import sys + + +@contextlib.contextmanager +def capture_stdout(file): + old_out = sys.stdout + sys.stdout = file + yield + sys.stdout = old_out diff --git a/src/ZPublisher/HTTPRequest.py b/src/ZPublisher/HTTPRequest.py index eda64eed59..3e51bd4f43 100644 --- a/src/ZPublisher/HTTPRequest.py +++ b/src/ZPublisher/HTTPRequest.py @@ -52,15 +52,6 @@ else: from cgi import escape -# Flags -SEQUENCE = 1 -DEFAULT = 2 -RECORD = 4 -RECORDS = 8 -REC = RECORD | RECORDS -EMPTY = 16 -CONVERTED = 32 - # This may get overwritten during configuration default_encoding = 'utf-8' @@ -785,7 +776,7 @@ def processInputs( if not hasattr(x, attr): # If the attribute does not - # exist, setit + # exist, set it if flags & SEQUENCE: item = [item] setattr(x, attr, item) diff --git a/versions-prod.cfg b/versions-prod.cfg index 1155ffb4a0..08f777f536 100644 --- a/versions-prod.cfg +++ b/versions-prod.cfg @@ -5,12 +5,12 @@ Zope = Zope2 = 4.0b1 AccessControl = 4.0b7 -Acquisition = 4.5 +Acquisition = 4.6 AuthEncoding = 4.1 BTrees = 4.5.1 -Chameleon = 3.6 +Chameleon = 3.6.1 DateTime = 4.3 -DocumentTemplate = 3.0b7 +DocumentTemplate = 3.0b8 ExtensionClass = 4.4 Missing = 4.1 MultiMapping = 4.1 @@ -87,9 +87,9 @@ zope.site = 4.2.2 zope.size = 4.3 zope.structuredtext = 4.3 zope.tal = 4.4 -zope.tales = 4.3 +zope.tales = 5.0 zope.testbrowser = 5.3.2 zope.testing = 4.7 -zope.testrunner = 4.9.2 +zope.testrunner = 5.0 zope.traversing = 4.3.1 zope.viewlet = 4.2.1 diff --git a/versions.cfg b/versions.cfg index 999fcbe6b3..80922c979b 100644 --- a/versions.cfg +++ b/versions.cfg @@ -6,7 +6,7 @@ versions = versions [versions] # Version pins for development and optional dependencies. Babel = 2.6.0 -Jinja2 = 2.10 +Jinja2 = 2.10.1 MarkupSafe = 1.1.1 Paste = 3.0.8 Pygments = 2.3.1 @@ -17,51 +17,51 @@ backports.functools-lru-cache = 1.5 beautifulsoup4 = 4.7.1 bleach = 3.1.0 buildout.wheel = 0.2.0 -certifi = 2018.11.29 -cffi = 1.12.2 +certifi = 2019.3.9 +cffi = 1.12.3 chardet = 3.0.4 cmarkgfm = 0.4.2 collective.recipe.cmd = 0.11 collective.recipe.sphinxbuilder = 1.1 collective.recipe.template = 2.1 colorama = 0.4.1 -coverage = 4.5.2 +coverage = 4.5.3 docutils = 0.14 filelock = 3.0.10 idna = 2.8 imagesize = 1.1.0 -lxml = 4.3.2 +lxml = 4.3.3 manuel = 1.10.1 mr.developer = 2.0.0 nose = 1.3.7 packaging = 19.0 -pip = 19.0.3 +pip = 19.1 pkginfo = 1.5.0.1 plone.recipe.command = 1.1 pluggy = 0.9.0 py = 1.8.0 pycparser = 2.19 -pyparsing = 2.3.1 +pyparsing = 2.4.0 python-gettext = 4.0 readme-renderer = 24.0 repoze.sphinx.autointerface = 0.8 requests = 2.21.0 requests-toolbelt = 0.9.1 snowballstemmer = 1.2.1 -soupsieve = 1.8 +soupsieve = 1.9.1 sphinx-rtd-theme = 0.4.3 sphinxcontrib-websupport = 1.1.0 toml = 0.10.0 -tox = 3.7.0 +tox = 3.9.0 tqdm = 4.31.1 twine = 1.13.0 typing = 3.6.6 urllib3 = 1.24.1 -virtualenv = 16.4.3 +virtualenv = 16.5.0 webencodings = 0.5.1 wheel = 0.33.1 z3c.checkversions = 1.1 zc.recipe.egg = 2.0.7 zc.recipe.testrunner = 2.0.0 -zest.releaser = 6.17.0 +zest.releaser = 6.18.2 zodbupdate = 1.1