From a949f80acc6677a1c85e71ce0c8c694ce2a63da7 Mon Sep 17 00:00:00 2001 From: Jason Madden Date: Wed, 26 Apr 2017 08:25:37 -0500 Subject: [PATCH] cleanups --- setup.py | 2 +- src/zope/app/form/browser/formview.py | 1 - src/zope/app/form/browser/metaconfigure.py | 1 + .../app/form/browser/tests/test_functional_i18n.py | 5 +++-- src/zope/app/form/browser/widgets.rst | 11 +++++------ src/zope/app/form/tests/test_utility.py | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index 129b11f..e14f8ac 100644 --- a/setup.py +++ b/setup.py @@ -65,7 +65,7 @@ def read(*rnames): 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: Implementation :: CPython', 'Programming Language :: Python :: Implementation :: PyPy', - 'Natural Language :: English', + 'Natural Language :: English', 'Operating System :: OS Independent', 'Topic :: Internet :: WWW/HTTP', 'Framework :: Zope3', diff --git a/src/zope/app/form/browser/formview.py b/src/zope/app/form/browser/formview.py index b382265..e12a459 100644 --- a/src/zope/app/form/browser/formview.py +++ b/src/zope/app/form/browser/formview.py @@ -44,7 +44,6 @@ def getData(self): This method should return a dictionary mapping field names to values. """ - # pragma: no cover raise NotImplementedError('Must be implemented by a specific form class') def setData(self, data): diff --git a/src/zope/app/form/browser/metaconfigure.py b/src/zope/app/form/browser/metaconfigure.py index 2dcb87e..de005ca 100644 --- a/src/zope/app/form/browser/metaconfigure.py +++ b/src/zope/app/form/browser/metaconfigure.py @@ -71,6 +71,7 @@ def __init__(self, _context, **kwargs): # returned from the filesystem) And on Python 3, bytes # != str so the utilities can't be found. So we have # to correct this if we want our translations to work. + # See https://github.com/zopefoundation/zope.configuration/issues/17 if (bytes is not str and hasattr(value, 'domain') and isinstance(value.domain, bytes)): diff --git a/src/zope/app/form/browser/tests/test_functional_i18n.py b/src/zope/app/form/browser/tests/test_functional_i18n.py index e921277..083c8be 100644 --- a/src/zope/app/form/browser/tests/test_functional_i18n.py +++ b/src/zope/app/form/browser/tests/test_functional_i18n.py @@ -75,8 +75,9 @@ class FieldContent(Persistent): class _FakeResponse(FakeResponse): if str is bytes: - # py2 has a bug, assuming headers are in unicode already, or - # are decodable implicitly to ascii + # Up through at least 4.0.0 of zope.app.wsgi, Py2 has a bug, + # assuming headers are in unicode already, or are decodable + # implicitly to ascii def getHeaders(self): headers = super(_FakeResponse, self).getHeaders() result = [] diff --git a/src/zope/app/form/browser/widgets.rst b/src/zope/app/form/browser/widgets.rst index 0f0c73b..eb92e7a 100644 --- a/src/zope/app/form/browser/widgets.rst +++ b/src/zope/app/form/browser/widgets.rst @@ -47,24 +47,23 @@ The implementation is shown in the ``poll.py`` source below:: >>> @implementer(IPoll) ... class Poll(Persistent, object): ... - ... - ... def getResponse(self, option): + ... def getResponse(self, option): ... return self._responses[option] ... - ... def choose(self, option): + ... def choose(self, option): ... self._responses[option] += 1 ... self._p_changed = 1 ... - ... def get_options(self): + ... def get_options(self): ... return self._options ... - ... def set_options(self, options): + ... def set_options(self, options): ... self._options = options ... self._responses = {} ... for option in self._options: ... self._responses[option.label] = 0 ... - ... options = property(get_options, set_options, None, 'fiddle options') + ... options = property(get_options, set_options, None, 'fiddle options') diff --git a/src/zope/app/form/tests/test_utility.py b/src/zope/app/form/tests/test_utility.py index 5410060..f83c608 100644 --- a/src/zope/app/form/tests/test_utility.py +++ b/src/zope/app/form/tests/test_utility.py @@ -489,7 +489,7 @@ def test_names(self): for a view: >>> view = BrowserView(Content(), request) - >>> sorted(list(IContent.names())) + >>> sorted(IContent.names()) ['bar', 'foo'] >>> setUpWidgets(view, IContent, IWidget, names=('bar',)) >>> hasattr(view, 'foo_widget')