Skip to content

Commit

Permalink
Merge branch 'master' into revise-section-character-encodings
Browse files Browse the repository at this point in the history
  • Loading branch information
dataflake committed Apr 27, 2019
2 parents 1a2e535 + 9207e2b commit 8b09d46
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 50 deletions.
10 changes: 5 additions & 5 deletions constraints.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
10 changes: 5 additions & 5 deletions requirements-full.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
20 changes: 11 additions & 9 deletions src/App/dtml/manage_page_footer.dtml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<dtml-unless "REQUEST.get('zmi_dialog','window')=='modal'"
><dtml-unless "'/manage_menu' in REQUEST.URL">
<script>
// Helpers for Menu Handling <dtml-var "REQUEST.URL">
var manage_menu = typeof window.parent.frames!="undefined"&&typeof window.parent.frames.manage_menu!="undefined";
window.parent.history.replaceState('','Main','<dtml-var URL>')
</script>
</dtml-unless>
</body>
<dtml-unless "REQUEST.get('zmi_dialog','window')=='modal'">
<dtml-unless "'/manage_menu' in REQUEST.URL">
<script>
// Helpers for Menu Handling <dtml-var "REQUEST.URL">
var manage_menu = typeof window.parent.frames!="undefined"&&typeof window.parent.frames.manage_menu!="undefined";
<dtml-if "REQUEST.get('method','') == 'GET'">
window.parent.history.replaceState('','Main','<dtml-var URL>')
</dtml-if>
</script>
</dtml-unless>
</body>
</html>
</dtml-unless>
24 changes: 21 additions & 3 deletions src/OFS/browser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion src/Products/PageTemplates/tests/testZopePageTemplate.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<html>
<head>
<META http-equiv="content-type" content="text/html; charset=%s">
</hed>
</head>
<body>
test üöäÜÖÄß
</body>
Expand Down
7 changes: 6 additions & 1 deletion src/Products/PageTemplates/tests/test_persistenttemplate.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions src/Testing/utils.py
Original file line number Diff line number Diff line change
@@ -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
11 changes: 1 addition & 10 deletions src/ZPublisher/HTTPRequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions versions-prod.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
22 changes: 11 additions & 11 deletions versions.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

0 comments on commit 8b09d46

Please sign in to comment.