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

nobody at svn.erp5.org nobody at svn.erp5.org
Fri May 23 15:34:07 CEST 2008


Author: vincent
Date: Fri May 23 15:34:05 2008
New Revision: 21100

URL: http://svn.erp5.org?rev=21100&view=rev
Log:
Minor performance improvements:
  Make createAccessor return generated accessor to save one getattr in _aq_dynamic.
  Merge 2 tests in a single "if".

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=21100&r1=21099&r2=21100&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Base.py (original)
+++ erp5/trunk/products/ERP5Type/Base.py Fri May 23 15:34:05 2008
@@ -334,6 +334,7 @@
         else:
           accessor.registerTransitionAlways(ptype, wf_id, tr_id)
     setattr(self, id, accessor)
+    return accessor
 
   def registerAccessor(self, id, key, accessor_class, accessor_args):
     """
@@ -864,10 +865,8 @@
     try:
       property_holder = Base.aq_portal_type[aq_key]
       accessor = getattr(property_holder, id, None)
-      if type(accessor) is tuple:
-        if id not in RESERVED_TUPLE_PROPERTY:
-          property_holder.createAccessor(id)
-          accessor = getattr(property_holder, id, None)
+      if type(accessor) is tuple and id not in RESERVED_TUPLE_PROPERTY:
+        accessor = property_holder.createAccessor(id)
       return accessor
     except KeyError:
       pass




More information about the Erp5-report mailing list