[Twisted-Python] woven-bug: multiple nodes using the same model

Paul Boehm typo at soniq.net
Wed Oct 9 08:56:57 MDT 2002


ok,

this fixes at least the problem with List repeating the same
element all over (instead of listing all elements).
(patch made against my local tree, also contains added CheckBox
functionality).

i'm still working on the problem that the view lags behind the model.

diff -u -r1.20 widgets.py
--- widgets.py  3 Oct 2002 15:46:26 -0000       1.20
+++ widgets.py  9 Oct 2002 14:55:54 -0000
@@ -270,7 +270,7 @@
         newNode = self.generateDOM(request, oldNode)
         mutator = template.NodeNodeMutator(newNode)
         mutator.d = request.d
-        mutator.generate(request, oldNode)
+        mutator.generate(request, newNode)
         self.node = newNode

     def __setitem__(self, item, value):
@@ -395,6 +395,11 @@
 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