From 9180b754484937865d30732897fe12fcd716be0c Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Thu, 17 Feb 2011 14:32:46 +0000 Subject: [PATCH] Speed up PortalTypeMetaClass.getAccessorHolderPropertyList by ~10% git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43423 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/dynamic/lazy_class.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/product/ERP5Type/dynamic/lazy_class.py b/product/ERP5Type/dynamic/lazy_class.py index ffb4632b65..2c2d94b926 100644 --- a/product/ERP5Type/dynamic/lazy_class.py +++ b/product/ERP5Type/dynamic/lazy_class.py @@ -143,17 +143,12 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder): @see Products.ERP5Type.Base.Base._propertyMap """ cls.loadClass() - property_id_set = set() - property_list = [] + property_dict = {} for klass in cls.mro(): if klass.__module__ == 'erp5.accessor_holder': for property in klass._properties: - if property['id'] in property_id_set: - continue - property_id_set.update([property['id']]) - property_list.append(property) - - return property_list + property_dict.setdefault(property['id'], property) + return property_dict.values() def resetAcquisition(cls): # First, fill the __get__ slot of the class -- 2.30.9