[Erp5-report] r31695 jm - /erp5/trunk/products/ERP5Type/Base.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jan 11 20:40:12 CET 2010


Author: jm
Date: Mon Jan 11 20:40:11 2010
New Revision: 31695

URL: http://svn.erp5.org?rev=31695&view=rev
Log:
Interaction workflow: recognize more special characters for regexp in method id

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=31695&r1=31694&r2=31695&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Base.py [utf8] Mon Jan 11 20:40:11 2010
@@ -104,7 +104,7 @@
 _MARKER = []
 
 global registered_workflow_method_set
-wildcard_interaction_method_id_matcher = re.compile(".*[\+\*].*")
+wildcard_interaction_method_id_match = re.compile(r'[[.?*+{(\\]').search
 workflow_method_registry = [] # XXX A set() would be better but would require a hash in WorkflowMethod class
 
 def resetRegisteredWorkflowMethod(portal_type=None):
@@ -667,13 +667,14 @@
         if tdef.trigger_type == TRIGGER_WORKFLOW_METHOD:
           # XXX Prefiltering per portal type would be more efficient
           for imethod_id in tdef.method_id:
-            if bool(wildcard_interaction_method_id_matcher.match(imethod_id)):
+            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)
+              method_id_list = prop_holder.getAccessorMethodIdList() + \
+                               prop_holder.getWorkflowMethodIdList() + \
+                               prop_holder.getClassMethodIdList(klass)
                 # XXX - class stuff is missing here
-              method_id_list = [x for x in method_id_list if method_id_matcher.match(x)]
+              method_id_list = filter(method_id_matcher.match, method_id_list)
             else:
               # Single method
               method_id_list = [imethod_id]




More information about the Erp5-report mailing list