[Erp5-report] r19504 - /erp5/trunk/products/ERP5Form/ListBox.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Feb 26 12:01:14 CET 2008
Author: alex
Date: Tue Feb 26 12:01:13 2008
New Revision: 19504
URL: http://svn.erp5.org?rev=19504&view=rev
Log:
* rename ObjectValuesWrapper to ListMethodWrapper
* wrap 'contentValues' as well as 'objectValues'
This allows acquired properties to be displayed in a listbox, when
contentValues is used as the list method.
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=19504&r1=19503&r2=19504&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ListBox.py (original)
+++ erp5/trunk/products/ERP5Form/ListBox.py Tue Feb 26 12:01:13 2008
@@ -59,17 +59,16 @@
except NameError:
from sets import Set as set
-class ObjectValuesWrapper:
- """This class wraps objectValues so that objectValues behaves like portal_catalog.
+class ListMethodWrapper:
+ """This class wraps list methods so that they behave like portal_catalog.
"""
- method_name = __name__ = 'objectValues'
-
- def __init__(self, context):
+ def __init__(self, context, method_name):
self.context = context
+ self.method_name = self.__name__ = method_name
def __call__(self, *args, **kw):
brain_list = []
- for obj in self.context.objectValues(*args, **kw):
+ for obj in getattr(self.context, self.method_name)(*args, **kw):
brain = ZSQLBrain(None, None).__of__(obj)
brain.uid = obj.getUid()
brain.path = obj.getPath()
@@ -1025,8 +1024,8 @@
"""
list_method_name = self.getListMethodName()
- if list_method_name == 'objectValues':
- list_method = ObjectValuesWrapper(self.getContext())
+ if list_method_name in ('objectValues', 'contentValues'):
+ list_method = ListMethodWrapper(self.getContext(), list_method_name)
elif list_method_name is not None:
try:
list_method = getattr(self.getContext(), list_method_name)
More information about the Erp5-report
mailing list