[Erp5-report] r42494 nicolas.dumazet - /erp5/trunk/products/ERP5Type/Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 20 08:35:14 CET 2011


Author: nicolas.dumazet
Date: Thu Jan 20 08:35:14 2011
New Revision: 42494

URL: http://svn.erp5.org?rev=42494&view=rev
Log:
do not compute n_workflow*n_interactions*n_methods*2 times the same list

Modified:
    erp5/trunk/products/ERP5Type/Base.py

Modified: erp5/trunk/products/ERP5Type/Base.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Base.py?rev=42494&r1=42493&r2=42494&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Base.py [utf8] Thu Jan 20 08:35:14 2011
@@ -697,6 +697,13 @@ def initializePortalTypeDynamicWorkflowM
           method.registerTransitionAlways(ptype, wf_id, transition_id)
       method.registerTransitionAlways(ptype, wf_id, tr_id)
 
+  if interaction_workflow_dict:
+    # only compute once this (somehow) costly list
+    all_method_id_list = prop_holder.getAccessorMethodIdList() + \
+                         prop_holder.getWorkflowMethodIdList() + \
+                         prop_holder.getClassMethodIdList(klass)
+  else:
+    all_method_id_list = []
   # XXX This part is (more or less...) a copy and paste
   # We need to run this part twice in order to handle interactions of interactions
   # ex. an interaction workflow creates a workflow method which matches
@@ -709,11 +716,8 @@ def initializePortalTypeDynamicWorkflowM
         if wildcard_interaction_method_id_match(imethod_id):
           # Interactions workflows can use regexp based wildcard methods
           method_id_matcher = re.compile(imethod_id) # XXX What happens if exception ?
-          method_id_list = prop_holder.getAccessorMethodIdList() + \
-                           prop_holder.getWorkflowMethodIdList() + \
-                           prop_holder.getClassMethodIdList(klass)
             # XXX - class stuff is missing here
-          method_id_list = filter(method_id_matcher.match, method_id_list)
+          method_id_list = filter(method_id_matcher.match, all_method_id_list)
         else:
           # Single method
           # XXX What if the method does not exist ?



More information about the Erp5-report mailing list