[Erp5-report] r8879 - /erp5/trunk/products/ERP5Form/ListBox.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jul 28 18:31:05 CEST 2006


Author: kevin
Date: Fri Jul 28 18:30:59 2006
New Revision: 8879

URL: http://svn.erp5.org?rev=8879&view=rev
Log:
Add getListMethodName on Listboxes.
Fix code indention.

Modified:
    erp5/trunk/products/ERP5Form/ListBox.py

Modified: erp5/trunk/products/ERP5Form/ListBox.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ListBox.py?rev=8879&r1=8878&r2=8879&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ListBox.py (original)
+++ erp5/trunk/products/ERP5Form/ListBox.py Fri Jul 28 18:30:59 2006
@@ -2878,25 +2878,35 @@
 ListBoxValidatorInstance = ListBoxValidator()
 
 class ListBox(ZMIField):
-    meta_type = "ListBox"
-
-    widget = ListBoxWidgetInstance
-    validator = ListBoxValidatorInstance
-
-    security = ClassSecurityInfo()
-
-    security.declareProtected('Access contents information', 'get_value')
-    def get_value(self, id, **kw):
-      if (id == 'default'):
-        if (kw.get('render_format') in ('list', )):
-          return self.widget.render(self, self.generate_field_key(), None,
-                                    kw.get('REQUEST'),
-                                    render_format=kw.get('render_format'))
-        else:
-          return None
+  meta_type = "ListBox"
+
+  widget = ListBoxWidgetInstance
+  validator = ListBoxValidatorInstance
+
+  security = ClassSecurityInfo()
+
+  security.declareProtected('Access contents information', 'get_value')
+  def get_value(self, id, **kw):
+    if (id == 'default'):
+      if (kw.get('render_format') in ('list', )):
+        return self.widget.render(self, self.generate_field_key(), None,
+                                  kw.get('REQUEST'),
+                                  render_format=kw.get('render_format'))
       else:
-        return ZMIField.get_value(self, id, **kw)
-
+        return None
+    else:
+      return ZMIField.get_value(self, id, **kw)
+
+  security.declareProtected('Access contents information', 'getListMethodName')
+  def getListMethodName(self):
+    """Return the name of the list method. If not defined, return None.
+    """
+    list_method = self.get_value('list_method')
+    try:
+      name = getattr(list_method, 'method_name')
+    except AttributeError:
+      name = list_method
+    return name or None
 
 
 class ListBoxLine:




More information about the Erp5-report mailing list