[Erp5-report] r41737 nicolas.dumazet - /erp5/trunk/products/ERP5Type/Utils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Dec 24 06:41:01 CET 2010


Author: nicolas.dumazet
Date: Fri Dec 24 06:41:00 2010
New Revision: 41737

URL: http://svn.erp5.org?rev=41737&view=rev
Log:
type_definition is a dictionary, a has_key lookup is faster than getting the key list

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

Modified: erp5/trunk/products/ERP5Type/Utils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Utils.py?rev=41737&r1=41736&r2=41737&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Utils.py [utf8] Fri Dec 24 06:41:00 2010
@@ -1298,7 +1298,6 @@ def setDefaultProperties(property_holder
     Set default attributes in current object for all properties in '_properties'
     """
     econtext = createExpressionContext(object, portal)
-    legalTypes = type_definition.keys()
     # First build the property list from the property sheet
     # and the class properties
     prop_list = []
@@ -1359,7 +1358,7 @@ def setDefaultProperties(property_holder
                                   Permissions.ModifyPortalContent)
       if isinstance(write_permission, Expression):
         write_permission = write_permission(econtext)
-      if prop['type'] in legalTypes:
+      if prop['type'] in type_definition:
         if 'base_id' in prop:
           continue
         if not converted_prop_keys.has_key(prop['id']):
@@ -1561,7 +1560,7 @@ def setDefaultProperties(property_holder
     # We remove such properties here
     #from Base import Base as BaseClass
     for prop in converted_prop_list:
-      if prop['type'] in legalTypes:
+      if prop['type'] in type_definition:
         #if not hasattr(property_holder, prop['id']):
           # setattr(property_holder, prop['id'], None) # This makes sure no acquisition will happen
           # but is wrong when we use storage_id .....



More information about the Erp5-report mailing list