Skip to content

Commit

Permalink
Bugfix: The ChoiceTerms adapter blindly assumed that the passed i…
Browse files Browse the repository at this point in the history
…n field

is unbound, which is not necessarily the case in interesting ObjectWidget
scenarios. Not it checks for a non-None field context first. [srichter]
  • Loading branch information
agroszer committed Feb 25, 2016
1 parent a698829 commit 688d12f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.txt
Expand Up @@ -9,6 +9,9 @@ CHANGES

- CheckBoxWidget items are better determined when they are needed [agroszer]

- Bugfix: The ``ChoiceTerms`` adapter blindly assumed that the passed in field
is unbound, which is not necessarily the case in interesting ObjectWidget
scenarios. Not it checks for a non-None field context first. [srichter]

3.2.9 (2016-02-01)
------------------
Expand Down
3 changes: 2 additions & 1 deletion src/z3c/form/term.py
Expand Up @@ -101,7 +101,8 @@ def __contains__(self, value):
zope.schema.interfaces.IChoice,
interfaces.IWidget)
def ChoiceTerms(context, request, form, field, widget):
field = field.bind(context)
if field.context is None:
field = field.bind(context)
terms = field.vocabulary
return zope.component.queryMultiAdapter(
(context, request, form, field, terms, widget),
Expand Down

0 comments on commit 688d12f

Please sign in to comment.