Skip to content

Commit

Permalink
fixing problems around objectwidget
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Groszer committed Sep 12, 2012
1 parent 21f5329 commit b055437
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/z3c/form/browser/objectmulti.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ just cry about it in the HTML:
<div class="widget">
<input class="text-widget required int-field"
id="foo-0-widgets-foofield" name="foo.0.widgets.foofield"
type="text">
type="text" value="">
</div>
<div class="label">
<label for="foo-0-widgets-barfield">
Expand Down
8 changes: 7 additions & 1 deletion src/z3c/form/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,13 @@ def applyValue(self, widget, value=interfaces.NO_VALUE):
"""Validate and apply value to given widget.
"""
if self.context is None:
widget.value = value
converter = interfaces.IDataConverter(widget)
try:
widget.value = converter.toWidgetValue(value)
except TypeError:
# we're not checking the value, because there's no context
# in case of problems just set a bad value
widget.value = value
else:
context = None
if not self.ignoreContext:
Expand Down

0 comments on commit b055437

Please sign in to comment.