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

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Feb 3 08:01:11 CET 2008


Author: vincent
Date: Sun Feb  3 08:01:10 2008
New Revision: 19010

URL: http://svn.erp5.org?rev=19010&view=rev
Log:
Factorize self.filter_dict[method_name] lookups.
Use an ImmutableSet instead of a dict where value = key.

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=19010&r1=19009&r2=19010&view=diff
==============================================================================
--- erp5/trunk/products/ZSQLCatalog/SQLCatalog.py (original)
+++ erp5/trunk/products/ZSQLCatalog/SQLCatalog.py Sun Feb  3 08:01:10 2008
@@ -44,6 +44,7 @@
 from xml.sax.saxutils import escape, quoteattr
 import os
 import md5
+from sets import ImmutableSet
 
 try:
   from Products.CMFCore.Expression import Expression
@@ -1708,15 +1709,15 @@
         kw = {}
         if self.isMethodFiltered(method_name):
           catalogged_object_list = []
-          type_list = self.filter_dict[method_name]['type']
-          type_dict = dict(zip(type_list, type_list)) or None
-          expression = self.filter_dict[method_name]['expression_instance']
-          expression_cache_key_list = self.filter_dict[method_name].get('expression_cache_key', '').split()
+          filter = self.filter_dict[method_name]
+          type_set = ImmutableSet(filter['type']) or None
+          expression = filter['expression_instance']
+          expression_cache_key_list = filter.get('expression_cache_key', '').split()
           for object in object_list:
             # We will check if there is an filter on this
             # method, if so we may not call this zsqlMethod
             # for this object
-            if type_dict is not None and object.getPortalType() not in type_dict:
+            if type_set is not None and object.getPortalType() not in type_set:
               continue
             elif expression is not None:
               if expression_cache_key_list:




More information about the Erp5-report mailing list