[Twisted-Python] woven.widgets

Paul Boehm typo at soniq.net
Fri Oct 4 10:52:57 MDT 2002


CheckBox can now be checked by truth in the model

and: is there a reason not to set self['value'] if
self.getData() returns a value that isn't true?

diff -u -r1.20 widgets.py
--- widgets.py  3 Oct 2002 15:46:26 -0000       1.20
+++ widgets.py  4 Oct 2002 16:52:50 -0000
@@ -388,13 +388,17 @@

     def generateDOM(self, request, node):
         mVal = self.getData()
-        if mVal:
-            self['value'] = str(mVal)
+        self['value'] = str(mVal)
         return Widget.generateDOM(self, request, node)

 class CheckBox(Input):
     def initialize(self):
         self['type'] = 'checkbox'
+    def generateDOM(self, request, node):
+        node = Input.generateDOM(self, request, node)
+        if self.getData():
+            node.setAttribute('checked', "checked")
+        return node

 class RadioButton(Input):
     def initialize(self):





More information about the Twisted-Python mailing list