[Erp5-report] r17122 - /erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Oct 23 15:15:50 CEST 2007


Author: jerome
Date: Tue Oct 23 15:15:50 2007
New Revision: 17122

URL: http://svn.erp5.org?rev=17122&view=rev
Log:
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

Modified:
    erp5/trunk/products/ZSQLCatalog/SQLCatalog.py

Modified: erp5/trunk/products/ZSQLCatalog/SQLCatalog.py
URL: http://svn.erp5.org/erp5/trunk/products/ZSQLCatalog/SQLCatalog.py?rev=17122&r1=17121&r2=17122&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py Tue Oct 23 15:15:50 2007
@@ -1558,7 +1558,7 @@
     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 @@
       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 @@
             # 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 @@
           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:




More information about the Erp5-report mailing list