From 7ab6216bc47f2b39fba2b8de6c53ef448883e298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Tue, 23 Oct 2007 13:15:50 +0000 Subject: [PATCH] 3 small optimisations: * remove an unused call to object.getPath() * only calculate object.getPortalType() if type_list is empty * store portal_catalog in a variable instead of doing the getattr inside the loop git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17122 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ZSQLCatalog/SQLCatalog.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/product/ZSQLCatalog/SQLCatalog.py b/product/ZSQLCatalog/SQLCatalog.py index 7630e249b1..3a5605f88d 100644 --- a/product/ZSQLCatalog/SQLCatalog.py +++ b/product/ZSQLCatalog/SQLCatalog.py @@ -1558,7 +1558,7 @@ class Catalog( Folder, if not self.isIndexable(): return None - site_root = self.getSiteRoot() + portal_catalog = self.getSiteRoot().portal_catalog # Reminder about optimization: It might be possible to issue just one # query to get enought results to check uid & path consistency. @@ -1581,7 +1581,6 @@ class Catalog( Folder, uid_path_dict = self.getPathDictForUidList(uid_list=uid_list) for object in object_list: - path = object.getPath() if not getattr(aq_base(object), 'uid', None): try: object.uid = self.newUid() @@ -1665,8 +1664,7 @@ class Catalog( Folder, # We will check if there is an filter on this # method, if so we may not call this zsqlMethod # for this object - portal_type = object.getPortalType() - if type_list and portal_type not in type_list: + if type_list and object.getPortalType() not in type_list: continue elif expression is not None: try: @@ -1721,7 +1719,7 @@ class Catalog( Folder, continue kw = method_kw_dict[method_name] method = getattr(self, method_name) - method = aq_base(method).__of__(site_root.portal_catalog) # Use method in + method = aq_base(method).__of__(portal_catalog) # Use method in # the context of portal_catalog # Alter/Create row try: -- 2.30.9