Commit 5b8325ed authored by Kevin Deldycke's avatar Kevin Deldycke

Add getListMethodName on Listboxes.

Fix code indention.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@8879 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c8b8bf09
......@@ -2878,25 +2878,35 @@ class ListBoxValidator(Validator.Validator):
ListBoxValidatorInstance = ListBoxValidator()
class ListBox(ZMIField):
meta_type = "ListBox"
meta_type = "ListBox"
widget = ListBoxWidgetInstance
validator = ListBoxValidatorInstance
widget = ListBoxWidgetInstance
validator = ListBoxValidatorInstance
security = ClassSecurityInfo()
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
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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment