[Twisted-Python] web.static & woven.widgets patches

Paul Boehm typo at soniq.net
Wed Oct 9 07:25:00 MDT 2002


hi,

the included patches haven't been applied to the repository yet.

there's no unittest for web Redirects, and the
the patch to static.py is a bugfix. while it probably isn't
the cleanest way to do these redirects, it's definitely better 
than the original code which breaks index.rpy query_string's,
and leads to urls like http://bla///////.

i too found no unittests for woven, and my patch allows to
check checkboxes via the model. this shouldn't break anything
either.

can anyone give me a statement regarding those patches?

diff -u -r1.63 static.py
--- static.py   1 Oct 2002 17:28:46 -0000       1.63
+++ static.py   4 Oct 2002 16:58:34 -0000
@@ -253,10 +253,12 @@
             # If someone is looking for children with a PathReferenceContext,
             # the request won't have a prepath, and we shouldn't do this kind
             # of mangling anyway because it has already been done.
-            if hasattr(request, 'postpath') and not request.postpath and request.uri[-1] != '/':
+            if hasattr(request, 'postpath') and not request.postpath and \
+                        string.split(request.uri,'?')[0][-1] != '/':
                 return Redirect(request)
             if os.path.exists(childPath):
-                if hasattr(request, 'postpath') and not request.postpath and not self.getIndex(request):
+                if hasattr(request, 'postpath') and not request.postpath and \
+                                                not self.getIndex(request):
                     return widgets.WidgetPage(DirectoryListing(self.path))


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