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

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 20 08:40:10 CET 2011


Author: nicolas.dumazet
Date: Thu Jan 20 08:40:10 2011
New Revision: 42496

URL: http://svn.erp5.org?rev=42496&view=rev
Log:
getattr() only once

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=42496&r1=42495&r2=42496&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Base.py [utf8] Thu Jan 20 08:40:10 2011
@@ -671,13 +671,13 @@ def initializePortalTypeDynamicWorkflowM
     transition_id_set, trigger_dict = v
     for tr_id, tdef in trigger_dict.iteritems():
       method_id = convertToMixedCase(tr_id)
-      if getattr(klass, method_id, _MARKER) is _MARKER:
+      method = getattr(klass, method_id, _MARKER)
+      if method is _MARKER:
         prop_holder.security.declareProtected(Permissions.AccessContentsInformation,
                                               method_id)
         prop_holder.registerWorkflowMethod(method_id, wf_id, tr_id)
         continue
 
-      method = getattr(klass, method_id)
       # Wrap method
       if not callable(method):
         LOG('initializePortalTypeDynamicWorkflowMethods', 100,
@@ -725,7 +725,8 @@ def initializePortalTypeDynamicWorkflowM
           #     It's not consistent with regexp based filters.
           method_id_list = [imethod_id]
         for method_id in method_id_list:
-          if getattr(klass, method_id, _MARKER) is _MARKER:
+          method = getattr(klass, method_id, _MARKER)
+          if method is _MARKER:
             # set a default security, if this method is not already
             # protected.
             if method_id not in prop_holder.security.names:
@@ -735,7 +736,6 @@ def initializePortalTypeDynamicWorkflowM
                                                    tdef.once_per_transaction)
             continue
 
-          method = getattr(klass, method_id)
           # Wrap method
           if not callable(method):
             LOG('initializePortalTypeDynamicWorkflowMethods', 100,



More information about the Erp5-report mailing list