[Erp5-report] r31120 kazuhiko - /erp5/trunk/products/ERP5/Document/BusinessProcess.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Dec 7 14:45:49 CET 2009


Author: kazuhiko
Date: Mon Dec  7 14:45:48 2009
New Revision: 31120

URL: http://svn.erp5.org?rev=31120&view=rev
Log:
code cleanup.

Modified:
    erp5/trunk/products/ERP5/Document/BusinessProcess.py

Modified: erp5/trunk/products/ERP5/Document/BusinessProcess.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/BusinessProcess.py?rev=31120&r1=31119&r2=31120&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/BusinessProcess.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/BusinessProcess.py [utf8] Mon Dec  7 14:45:48 2009
@@ -28,10 +28,8 @@
 #
 ##############################################################################
 
-from Products.ERP5Type.Globals import InitializeClass, PersistentMapping
 from AccessControl import ClassSecurityInfo
-
-from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces
+from Products.ERP5Type import Permissions, PropertySheet, interfaces
 from Products.ERP5Type.XMLObject import XMLObject
 from Products.ERP5.Document.Path import Path
 
@@ -84,17 +82,15 @@
     """
     # Naive implementation to redo XXX using contentValues
     if trade_phase is None:
-      trade_phase=[]
-    if not isinstance(trade_phase, (list, tuple)):
+      trade_phase = []
+    elif not isinstance(trade_phase, (list, tuple)):
       trade_phase = (trade_phase,)
     result = []
     if len(trade_phase) == 0:
-      return self.contentValues(portal_type="Business Path")
-    for document in self.contentValues(portal_type="Business Path"):
-      for phase in trade_phase:
-        if document.isMemberOf('trade_phase/' + phase): # XXX - not so good, use filter if possible
-          result.append(document)
-          break
+      return self.objectValues(portal_type="Business Path")
+    for document in self.objectValues(portal_type="Business Path"):
+      if document.getTradePhase() in trade_phase:
+        result.append(document)
     return result
 
   security.declareProtected(Permissions.AccessContentsInformation, 'getStateValueList')




More information about the Erp5-report mailing list