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

jjlee at codespeak.net jjlee at codespeak.net
Sat Oct 8 20:49:26 CEST 2005


Author: jjlee
Date: Sat Oct  8 20:49:25 2005
New Revision: 18294

Modified:
   wwwsearch/ClientForm/trunk/ClientForm.py
   wwwsearch/ClientForm/trunk/test.py
Log:
Fix 

Modified: wwwsearch/ClientForm/trunk/ClientForm.py
==============================================================================
--- wwwsearch/ClientForm/trunk/ClientForm.py	(original)
+++ wwwsearch/ClientForm/trunk/ClientForm.py	Sat Oct  8 20:49:25 2005
@@ -1933,8 +1933,9 @@
     def get_value_by_label(self):
         """Return the value of the control as given by normalized labels."""
         res = []
+        compat = self._form.backwards_compat
         for o in self.items:
-            if not o.disabled and o.selected:
+            if (not o.disabled or compat) and o.selected:
                 for l in o.get_labels():
                     if l.text:
                         res.append(l.text)
@@ -1943,7 +1944,7 @@
                     res.append(None)
         return res
 
-    def possible_items(self, by_label=False):  # disabled are not possible
+    def possible_items(self, by_label=False):
         """Deprecated: return the names or labels of all possible items.
 
         Includes disabled items, which may be misleading for some use cases.

Modified: wwwsearch/ClientForm/trunk/test.py
==============================================================================
--- wwwsearch/ClientForm/trunk/test.py	(original)
+++ wwwsearch/ClientForm/trunk/test.py	Sat Oct  8 20:49:25 2005
@@ -2241,6 +2241,11 @@
                 self.assertEqual(
                     [item.id for item in c.items if item.selected],
                     ["1", None])
+                # disabled items still part of 'value by label'
+                c.get(label="Loaf of Challah").disabled = True
+                self.assertEqual(
+                    c.get_value_by_label(),
+                    ["Loaf of Bread", "Loaf of Challah"])
             else:
                 self.assertEqual(
                     c.get_value_by_label(),
@@ -2248,6 +2253,11 @@
                 self.assertEqual(
                     [item.id for item in c.items if item.selected],
                     ["1", "2", None])
+                # disabled items NOT part of 'value by label'
+                c.get(label="Challah").disabled = True
+                self.assertEqual(
+                    c.get_value_by_label(),
+                    ["Loaf of Bread", "Loaf of Bread"])
 
     def testSearchByLabel(self):
         f = StringIO("""\


More information about the wwwsearch-commits mailing list