[Zope3-checkins] CVS: Zope3/src/zope/app/form - utility.py:1.24
Martijn Pieters
cvs-admin at zope.org
Mon Dec 1 18:11:36 EST 2003
Update of /cvs-repository/Zope3/src/zope/app/form
In directory cvs.zope.org:/tmp/cvs-serv13832/src/zope/app/form
Modified Files:
utility.py
Log Message:
Fix widget setup; docstring claims that widget is only set to value if it is
not None, but it is always set regardless.
My change implements the documented behaviour. This fixes default values for
widgets; if setRenderedValue isn't called for a given widget, it'll use the
field's default value when not having input. This'll cause checkboxes to
display as checked when the underlying Bool field's default is True, for
example.
Gary suggests that value should not be field.missing_value instead, but I am
following the docstring's lead here.
=== Zope3/src/zope/app/form/utility.py 1.23 => 1.24 ===
--- Zope3/src/zope/app/form/utility.py:1.23 Wed Aug 13 17:28:34 2003
+++ Zope3/src/zope/app/form/utility.py Mon Dec 1 18:11:36 2003
@@ -161,7 +161,9 @@
if prefix:
widget.setPrefix(prefix)
- if force or not widget.hasInput():
+ if force or not widget.hasInput() and value is not None:
+ # XXX: The doc string sez value should not be None; maybe it should not
+ # be field.missing_value instead?
widget.setRenderedValue(value)
More information about the Zope3-Checkins
mailing list