Skip to content

Commit

Permalink
#98111: (reopened) z.a.form.browser.itemswidget.MultiDataHelper._toFi…
Browse files Browse the repository at this point in the history
…eldValue() fix for empty values
  • Loading branch information
leorochael committed May 1, 2007
1 parent 0266b53 commit 2082ed4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions browser/itemswidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ class MultiDataHelper(object):
def _toFieldValue(self, input):
"""See SimpleInputWidget"""
if input is None:
return []
if not isinstance(input, list):
input = []
elif not isinstance(input, list):
input = [input]
try:
values = self.convertTokensToValues(input)
Expand Down
3 changes: 3 additions & 0 deletions browser/tests/test_itemswidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@ def test_getInputValue(self):
self.assertEqual(widget.getInputValue(), ['two', 'three'])

self._field = ICollector.get('letters')
widget = self._makeWidget(form={'field.letters-empty-marker': '1'})
widget.setPrefix('field.')
self.assertEqual(widget.getInputValue(), sets.Set())
widget = self._makeWidget(form={'field.letters': ['token2','token3']})
widget.setPrefix('field.')
self.assertEqual(widget.getInputValue(), sets.Set(['two', 'three']))
Expand Down

0 comments on commit 2082ed4

Please sign in to comment.