Skip to content

Commit

Permalink
Merge pull request #49 from plone/select-widget-items-callable-master
Browse files Browse the repository at this point in the history
In select widget, accept items as property or method.
  • Loading branch information
mauritsvanrees authored Sep 29, 2016
2 parents 2a690b2 + 8251e0e commit bb403e0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 5 additions & 2 deletions 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]


2.1.1 (2016-09-16)
Expand Down Expand Up @@ -75,7 +78,7 @@ Fixes:
- Reduce dependency on plone.app.widgets in tests.
[thet]

- Enhance test in order to show problem in RelatedItemsWidget with
- Enhance test in order to show problem in RelatedItemsWidget with
navigation-roots
[jensens]

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 @@ -270,8 +270,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 bb403e0

@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/47/violations

plone/app/z3cform/inline_validation.py:15:1: C901 'InlineValidationView.__call__' is too complex (15)
plone/app/z3cform/tests/test_utils.py:21:9: E731 do not assign a lambda expression, use a def

Follow these instructions to reproduce it locally.

Please sign in to comment.