[Checkins] SVN: Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py use explicit True/False

Hano Schlichting cvs-admin at zope.org
Sat Apr 7 11:00:08 UTC 2012


Log message for revision 125057:
  use explicit True/False
  

Changed:
  U   Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py

-=-
Modified: Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py	2012-04-07 10:53:29 UTC (rev 125056)
+++ Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py	2012-04-07 11:00:05 UTC (rev 125057)
@@ -295,7 +295,7 @@
     # the cataloging API
 
     def catalogObject(self, object, uid, threshold=None, idxs=None,
-                      update_metadata=1):
+                      update_metadata=True):
         """
         Adds an object to the Catalog by iteratively applying it to
         all indexes.
@@ -379,7 +379,6 @@
                       'attempted to uncatalog an object '
                       'with a uid of %s. ' % str(uid))
 
-
     def uniqueValuesFor(self, name):
         """ return unique values for FieldIndex name """
         return self.getIndex(name).uniqueValues()
@@ -479,7 +478,8 @@
             sequence.reverse()
         return (sequence, slen)
 
-    def search(self, query, sort_index=None, reverse=0, limit=None, merge=1):
+    def search(self,
+            query, sort_index=None, reverse=False, limit=None, merge=True):
         """Iterate through the indexes, applying the query to each one. If
         merge is true then return a lazy result set (sorted if appropriate)
         otherwise return the raw (possibly scored) results for later merging.
@@ -630,7 +630,7 @@
                               .__of__(aq_parent(self))
                         r.data_record_id_ = key
                         r.data_record_score_ = score
-                        r.data_record_normalized_score_ = int(100. * score / max)
+                        r.data_record_normalized_score_ = int(100.0 * score / max)
                         return r
 
                     sequence, slen = self._limit_sequence(rs, rlen, b_start,
@@ -663,8 +663,8 @@
         cr.stop()
         return result
 
-    def sortResults(self, rs, sort_index, reverse=0, limit=None, merge=1,
-                    actual_result_count=None, b_start=0, b_size=None):
+    def sortResults(self, rs, sort_index, reverse=False, limit=None,
+            merge=True, actual_result_count=None, b_start=0, b_size=None):
         # Sort a result set using a sort index. Return a lazy
         # result set in sorted order if merge is true otherwise
         # returns a list of (sortkey, uid, getter_function) tuples
@@ -909,7 +909,7 @@
             return sort_indexes
         return None
 
-    def searchResults(self, REQUEST=None, used=None, _merge=1, **kw):
+    def searchResults(self, REQUEST=None, used=None, _merge=True, **kw):
         # You should pass in a simple dictionary as the request argument,
         # which only contains the relevant query.
         # The used argument is deprecated and is ignored
@@ -928,12 +928,12 @@
             args = CatalogSearchArgumentsMap(REQUEST, kw)
         sort_indexes = self._getSortIndex(args)
         sort_limit = self._get_sort_attr('limit', args)
-        reverse = 0
+        reverse = False
         if sort_indexes is not None:
             order = self._get_sort_attr("order", args)
             if (isinstance(order, str) and
                 order.lower() in ('reverse', 'descending')):
-                reverse = 1
+                reverse = True
         # Perform searches with indexes and sort_index
         return self.search(args, sort_indexes, reverse, sort_limit, _merge)
 



More information about the checkins mailing list