From 155606ec10d120d2a14af2bb03771ba2fd2868e6 Mon Sep 17 00:00:00 2001 From: Nicolas Dumazet <nicolas.dumazet@nexedi.com> Date: Mon, 31 Jan 2011 09:08:57 +0000 Subject: [PATCH] use a set for slightly faster lookups git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42797 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/Base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index c101f6828e..87a033de3c 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -1682,7 +1682,7 @@ class Base( CopyContainer, unordered_key_list = [k for k in key_list if k not in edit_order] ordered_key_list = [k for k in edit_order if k in key_list] - restricted_method_list = [] + restricted_method_set = set() if restricted: # retrieve list of accessors which doesn't use default permissions aq_key = self._aq_key() @@ -1696,7 +1696,7 @@ class Base( CopyContainer, for permissions in prop_holder.__ac_permissions__: if permissions[0] not in ('Access contents information', 'Modify portal content'): for method in permissions[1]: - restricted_method_list.append(method) + restricted_method_set.add(method) getProperty = self.getProperty hasProperty = self.hasProperty @@ -1723,7 +1723,7 @@ class Base( CopyContainer, if not keep_existing or not hasProperty(key): if restricted: accessor_name = 'set' + UpperCase(key) - if accessor_name in restricted_method_list: + if accessor_name in restricted_method_set: # will raise Unauthorized when not allowed guarded_getattr(self, accessor_name) modified_property_dict[key] = old_value -- 2.30.9