[wwwsearch-commits] r33026 - wwwsearch/ClientForm/trunk

jjlee at codespeak.net jjlee at codespeak.net
Mon Oct 9 02:01:39 CEST 2006


Author: jjlee
Date: Mon Oct  9 02:01:38 2006
New Revision: 33026

Modified:
   wwwsearch/ClientForm/trunk/ClientForm.py
   wwwsearch/ClientForm/trunk/test.py
Log:
Nameless list controls should never be successful

Modified: wwwsearch/ClientForm/trunk/ClientForm.py
==============================================================================
--- wwwsearch/ClientForm/trunk/ClientForm.py	(original)
+++ wwwsearch/ClientForm/trunk/ClientForm.py	Mon Oct  9 02:01:38 2006
@@ -1924,6 +1924,8 @@
     def __getattr__(self, name):
         if name == "value":
             compat = self._form.backwards_compat
+            if self.name is None:
+                return []
             return [o.name for o in self.items if o.selected and
                     (not o.disabled or compat)]
         else:
@@ -2093,7 +2095,7 @@
         return [o.name for o in self.items]
 
     def _totally_ordered_pairs(self):
-        if self.disabled:
+        if self.disabled or self.name is None:
             return []
         else:
             return [(o._index, self.name, o.name) for o in self.items

Modified: wwwsearch/ClientForm/trunk/test.py
==============================================================================
--- wwwsearch/ClientForm/trunk/test.py	(original)
+++ wwwsearch/ClientForm/trunk/test.py	Mon Oct  9 02:01:38 2006
@@ -2999,20 +2999,20 @@
 <form>
   <input type="checkbox" name="foo"/>
   <input type="checkbox" name="bar"/>
-  <input type="checkbox" id="a" onclick="bar()"/>
+  <input type="checkbox" id="a" onclick="bar()" checked />
 </form>
 """,
 """\
 <form>
   <input type="checkbox" name="foo"/>
-  <input type="checkbox" id="a" onclick="bar()"/>
+  <input type="checkbox" id="a" onclick="bar()" checked />
 </form>
 """,
 """\
 <form>
   <input type="checkbox"/>
   <input type="checkbox"/>
-  <input type="checkbox" id="a" onclick="bar()"/>
+  <input type="checkbox" id="a" onclick="bar()" checked />
 </form>
 """,
             ]:
@@ -3023,6 +3023,7 @@
             # should have value "on", but not be successful
             self.assertEqual([item.name for item in bar.items], ["on"])
             self.assertEqual(bar.value, [])
+            self.assertEqual(form.click_pairs(), [])
 
 
 class ContentTypeTests(TestCase):


More information about the wwwsearch-commits mailing list