[Zope3-checkins] CVS: Zope3/src/zope/app/browser/form - widget.py:1.64.4.6

Garrett Smith garrett at mojave-corp.com
Sun Feb 8 02:38:27 EST 2004


Update of /cvs-repository/Zope3/src/zope/app/browser/form
In directory cvs.zope.org:/tmp/cvs-serv31887/src/zope/app/browser/form

Modified Files:
      Tag: ozzope-widgets-branch
	widget.py 
Log Message:

Moved some doctests over to test module.


=== Zope3/src/zope/app/browser/form/widget.py 1.64.4.5 => 1.64.4.6 ===
--- Zope3/src/zope/app/browser/form/widget.py:1.64.4.5	Sun Feb  8 00:36:09 2004
+++ Zope3/src/zope/app/browser/form/widget.py	Sun Feb  8 02:37:56 2004
@@ -325,80 +325,11 @@
         return self._showData()
 
 class CheckBoxWidget(BrowserWidget):
-    """Checkbox widget
-
-    >>> from zope.publisher.browser import TestRequest
-    >>> from zope.schema import Bool
-    >>> field = Bool(__name__='foo', title=u'on')
-    >>> request = TestRequest(form={'field.foo.used': u'on',
-    ...                             'field.foo': u'on'})
-    >>> widget = CheckBoxWidget(field, request)
-    >>> widget.hasInput()
-    True
-    >>> widget.getInputValue()
-    True
-
-    >>> def normalize(s):
-    ...   return '\\n  '.join(s.split())
-
-    >>> print normalize( widget() )
-    <input
-      class="hiddenType"
-      id="field.foo.used"
-      name="field.foo.used"
-      type="hidden"
-      value=""
-      />
-      <input
-      class="checkboxType"
-      checked="checked"
-      id="field.foo"
-      name="field.foo"
-      type="checkbox"
-      />
-
-    >>> print normalize( widget.hidden() )
-    <input
-      class="hiddenType"
-      id="field.foo"
-      name="field.foo"
-      type="hidden"
-      value="on"
-      />
-
-    Calling setRenderedValue will change what gets output:
-
-    >>> widget.setRenderedValue(False)
-    >>> print normalize( widget() )
-    <input
-      class="hiddenType"
-      id="field.foo.used"
-      name="field.foo.used"
-      type="hidden"
-      value=""
-      />
-      <input
-      class="checkboxType"
-      id="field.foo"
-      name="field.foo"
-      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
-    """
+    """A checkbox widget used to display Bool fields.
     
+    For more detailed documentation, including sample code, see
+    tests/test_checkboxwidget.py.
+    """
     implements(interfaces.ICheckBoxWidget)
     
     inputType = 'checkbox'




More information about the Zope3-Checkins mailing list