[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form -
widget.py:1.60
Sidnei da Silva
sidnei at x3ng.com.br
Mon Jan 12 17:00:20 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv12864/zope/app/browser/form
Modified Files:
widget.py
Log Message:
Fix a comment, add another doctest to clarify the CheckboxWidget behavior (which I had a hard time undestanding)
=== Zope3/src/zope/app/browser/form/widget.py 1.59 => 1.60 ===
--- Zope3/src/zope/app/browser/form/widget.py:1.59 Mon Jan 5 06:29:05 2004
+++ Zope3/src/zope/app/browser/form/widget.py Mon Jan 12 17:00:20 2004
@@ -206,7 +206,7 @@
if value == field.missing_value and not field.required:
return value
- # value must be valid per the field contraints
+ # value must be valid per the field constraints
try:
field.validate(value)
except ValidationError, v:
@@ -411,6 +411,19 @@
type="checkbox"
/>
+ When a checkbox is not 'checked', it's value is not
+ sent in the request, so we consider it 'False', which
+ means that 'required' for a boolean field doesn't make
+ much sense in the end.
+
+ >>> field = Bool(__name__='foo', title=u'on', required=True)
+ >>> request = TestRequest(form={'field.foo.used': u''})
+ >>> widget = CheckBoxWidget(field, request)
+ >>> widget.hasInput()
+ True
+ >>> widget.validate()
+ >>> widget.getInputValue()
+ False
"""
propertyNames = BrowserWidget.propertyNames + \
['extra', 'default']
More information about the Zope3-Checkins
mailing list