Commit 7ab6216b authored by Jérome Perrin's avatar Jérome Perrin

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
parent d362cca1
......@@ -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:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment