[Checkins] SVN: Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py distinguish reverse spec more clearly from algorithm choice

Hano Schlichting cvs-admin at zope.org
Sat Apr 7 18:12:38 UTC 2012


Log message for revision 125085:
  distinguish reverse spec more clearly from algorithm choice
  

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 17:59:45 UTC (rev 125084)
+++ Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py	2012-04-07 18:12:35 UTC (rev 125085)
@@ -720,11 +720,12 @@
             # limit to current maximum of sort indexes
             sort_spec = sort_spec[:sort_index_length]
             # use first sort order for choosing the algorithm
-            reverse = reverse[0]
+            first_reverse = reverse[0]
         else:
             sort_spec = []
             for i in xrange(sort_index_length):
                 sort_spec.append(reverse and -1 or 1)
+            first_reverse = reverse
 
         if merge and limit is None and (
             rlen > (len(sort_index) * (rlen / 100 + 1))):
@@ -792,7 +793,7 @@
                 sequence, _ = self._limit_sequence(result, 0, b_start, b_size,
                     switched_reverse)
                 return sequence
-        elif reverse:
+        elif first_reverse:
             # Limit / sort results using N-Best algorithm
             # This is faster for large sets then a full sort
             # And uses far less memory
@@ -831,7 +832,7 @@
                 sequence, _ = self._limit_sequence(result, 0, b_start, b_size,
                     switched_reverse)
                 return sequence
-        elif not reverse:
+        elif not first_reverse:
             # Limit / sort results using N-Best algorithm in reverse (N-Worst?)
             keys = []
             n = 0



More information about the checkins mailing list