[Erp5-report] r26542 - /erp5/trunk/products/ERP5Form/Selection.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Apr 21 11:22:00 CEST 2009


Author: vincent
Date: Tue Apr 21 11:21:56 2009
New Revision: 26542

URL: http://svn.erp5.org?rev=26542&view=rev
Log:
Simplify Selection.__call__ code.

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

Modified: erp5/trunk/products/ERP5Form/Selection.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/Selection.py?rev=26542&r1=26541&r2=26542&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/Selection.py [utf8] (original)
+++ erp5/trunk/products/ERP5Form/Selection.py [utf8] Tue Apr 21 11:21:56 2009
@@ -205,22 +205,16 @@
           del kw['sort_on'] # We should not sort if no sort was defined
         # We should always set selection_name with self.name
         kw['selection_name'] = self.name
-        if method is not None:
-          if callable(method):
-            if self.domain is not None and self.report is not None:
-              result = method(selection_domain = self.domain,
-                              selection_report = self.report, selection=self, **kw)
-            elif self.domain is not None:
-              result = method(selection_domain = self.domain, selection=self, **kw)
-            elif self.report is not None:
-              result = method(selection_report = self.report, selection=self, **kw)
-            else:
-              result = method(selection=self, **kw)
-            return result
-          else:
-            return []
+        kw['selection'] = self
+        if self.domain is not None:
+          kw['selection_domain'] = self.domain
+        if self.report is not None:
+          kw['selection_report'] = self.report
+        if callable(method):
+          result = method(**kw)
         else:
-          return []
+          result = []
+        return result
 
     def __getitem__(self, index, REQUEST=None):
         return self(REQUEST)[index]




More information about the Erp5-report mailing list