Skip to content

Commit

Permalink
In select widget, accept items as property or method.
Browse files Browse the repository at this point in the history
This avoids breaking on some z3c.form versions.
See zopefoundation/z3c.form#44
  • Loading branch information
mauritsvanrees committed Sep 29, 2016
1 parent cd9f13c commit 3ed66a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ New features:

Bug fixes:

- *add item here*
- In select widget, accept items as property or method.
This avoids breaking on some z3c.form versions.
See https://github.com/zopefoundation/z3c.form/issues/44
[maurits]


1.2.1 (2016-04-29)
Expand Down
10 changes: 9 additions & 1 deletion plone/app/z3cform/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,16 @@ def _base_args(self):
if not self.required:
options['allowClear'] = True

base_items = self.items
if callable(base_items):
# items used to be a property in all widgets, then in the select
# widget it became a method, then in a few others too, but never in
# all, so this was reverted to let it be a property again. Let's
# support both here to avoid breaking on some z3c.form versions.
# See https://github.com/zopefoundation/z3c.form/issues/44
base_items = base_items()
items = []
for item in self.items():
for item in base_items:
if not isinstance(item['content'], basestring):
item['content'] = translate(
item['content'],
Expand Down

1 comment on commit 3ed66a1

@jenkins-plone-org
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mauritsvanrees Jenkins CI reporting about code analysis
See the full report here: http://jenkins.plone.org/job/package-plone.app.z3cform/46/violations

plone/__init__.py:0:1: C101 Coding magic comment not found
plone/app/__init__.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/converters.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/csrf.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/inline_validation.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/inline_validation.py:14:1: C901 'InlineValidationView.__call__' is too complex (12)
plone/app/z3cform/inline_validation.py:23:12: P002 found "hasattr", consider replacing it
plone/app/z3cform/inline_validation.py:25:16: P002 found "hasattr", consider replacing it
plone/app/z3cform/inline_validation.py:29:26: Q000 Remove bad quotes.
plone/app/z3cform/inline_validation.py:34:9: E265 block comment should start with '# '
plone/app/z3cform/inline_validation.py:41:17: E731 do not assign a lambda expression, use a def
plone/app/z3cform/interfaces.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/interfaces.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/interfaces.py:6:80: E501 line too long (85 > 79 characters)
plone/app/z3cform/layout.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/layout.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/layout.py:2:1: F401 'FormWrapper' imported but unused
plone/app/z3cform/layout.py:2:1: F401 'wrap_form' imported but unused
plone/app/z3cform/object.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/object.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/templates.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/templates.py:13:1: E731 do not assign a lambda expression, use a def
plone/app/z3cform/utils.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/utils.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/widget.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/widget.py:7:80: E501 line too long (83 > 79 characters)
plone/app/z3cform/widget.py:147:29: Q000 Remove bad quotes.
plone/app/z3cform/widget.py:338:80: E501 line too long (84 > 79 characters)
plone/app/z3cform/widget.py:359:26: Q000 Remove bad quotes.
plone/app/z3cform/widget.py:359:27: S001 found %s formatter
plone/app/z3cform/widget.py:444:80: E501 line too long (84 > 79 characters)
plone/app/z3cform/widget.py:453:80: E501 line too long (84 > 79 characters)
plone/app/z3cform/widget.py:456:30: Q000 Remove bad quotes.
plone/app/z3cform/widget.py:456:31: S001 found %s formatter
plone/app/z3cform/widget.py:535:58: Q000 Remove bad quotes.
plone/app/z3cform/widget.py:584:35: P101 format string does contain unindexed parameters
plone/app/z3cform/widget.py:595:42: P101 format string does contain unindexed parameters
plone/app/z3cform/widget.py:596:44: P101 format string does contain unindexed parameters
plone/app/z3cform/widget.py:598:34: P101 format string does contain unindexed parameters
plone/app/z3cform/widget.py:621:28: P101 format string does contain unindexed parameters
plone/app/z3cform/queryselect/__init__.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/queryselect/__init__.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/queryselect/__init__.py:17:21: Q000 Remove bad quotes.
plone/app/z3cform/queryselect/__init__.py:17:80: E501 line too long (97 > 79 characters)
plone/app/z3cform/queryselect/__init__.py:18:21: Q000 Remove bad quotes.
plone/app/z3cform/wysiwyg/__init__.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/wysiwyg/__init__.py:2:1: F401 'WysiwygFieldWidget' imported but unused
plone/app/z3cform/wysiwyg/widget.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/wysiwyg/widget.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/wysiwyg/widget.py:43:17: Q000 Remove bad quotes.
plone/app/z3cform/wysiwyg/widget.py:43:80: E501 line too long (84 > 79 characters)
plone/app/z3cform/wysiwyg/widget.py:44:17: Q000 Remove bad quotes.
plone/app/z3cform/tests/example.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/tests/example.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/tests/example.py:16:16: Q000 Remove bad quotes.
plone/app/z3cform/tests/layer.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/tests/layer.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/tests/layer.py:33:10: Q000 Remove bad quotes.
plone/app/z3cform/tests/test_csrf.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/tests/test_objectsubform.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/tests/test_objectsubform.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/tests/test_objectsubform.py:34:35: S001 found %s formatter
plone/app/z3cform/tests/test_widget.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/tests/test_widget.py:32:80: E501 line too long (126 > 79 characters)
plone/app/z3cform/tests/test_widgets.py:0:1: I001 isort found changes, run it on the file
plone/app/z3cform/tests/test_widgets.py:549:14: D001 found assertEquals replace it with assertEqual
plone/app/z3cform/tests/test_widgets.py:552:14: D001 found assertEquals replace it with assertEqual
plone/app/z3cform/tests/test_widgets.py:769:36: D001 found directlyProvides replace it with zope.interface.provider
plone/app/z3cform/tests/test_widgets.py:771:9: D001 found directlyProvides replace it with zope.interface.provider
plone/app/z3cform/tests/test_widgets.py:893:80: E501 line too long (89 > 79 characters)
plone/app/z3cform/tests/test_widgets.py:902:80: E501 line too long (90 > 79 characters)
plone/app/z3cform/tests/test_widgets.py:1105:14: D001 found assertEquals replace it with assertEqual
plone/app/z3cform/tests/test_widgets.py:1144:80: E501 line too long (81 > 79 characters)
plone/app/z3cform/tests/test_widgets.py:1167:80: E501 line too long (82 > 79 characters)
plone/app/z3cform/tests/test_widgets.py:1253:14: D001 found assertEquals replace it with assertEqual
plone/app/z3cform/tests/test_widgets.py:1268:14: D001 found assertEquals replace it with assertEqual
plone/app/z3cform/tests/test_widgets.py:1276:39: Q000 Remove bad quotes.
plone/app/z3cform/tests/tests.py:0:1: C101 Coding magic comment not found
plone/app/z3cform/tests/tests.py:0:1: I001 isort found changes, run it on the file

Follow these instructions to reproduce it locally.

Please sign in to comment.