[Checkins] SVN: Products.ZCatalog/trunk/src/Products/ZCatalog/ Cover remaining sortResults case
Hano Schlichting
cvs-admin at zope.org
Sun Mar 25 22:58:53 UTC 2012
Log message for revision 124733:
Cover remaining sortResults case
Changed:
U Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py
U Products.ZCatalog/trunk/src/Products/ZCatalog/tests/test_catalog.py
-=-
Modified: Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py 2012-03-25 22:53:58 UTC (rev 124732)
+++ Products.ZCatalog/trunk/src/Products/ZCatalog/Catalog.py 2012-03-25 22:58:50 UTC (rev 124733)
@@ -764,11 +764,13 @@
for did in rs:
try:
key = index_key_map[did]
+ key2 = (index2_key_map is not None and
+ index2_key_map.get(did) or None)
except KeyError:
# This document is not in the sort key index, skip it.
pass
else:
- append((key, did, _self__getitem__))
+ append(((key, key2), did, _self__getitem__))
# The reference back to __getitem__ is used in case
# we do not merge now and need to intermingle the
# results with those of other catalogs while avoiding
Modified: Products.ZCatalog/trunk/src/Products/ZCatalog/tests/test_catalog.py
===================================================================
--- Products.ZCatalog/trunk/src/Products/ZCatalog/tests/test_catalog.py 2012-03-25 22:53:58 UTC (rev 124732)
+++ Products.ZCatalog/trunk/src/Products/ZCatalog/tests/test_catalog.py 2012-03-25 22:58:50 UTC (rev 124733)
@@ -520,6 +520,20 @@
for x in range(9):
self.assertTrue(a[x].num > a[x + 1].num)
+ def test_sort_on_two_big_limit(self):
+ a = self._catalog(sort_on=('att1', 'num'), att1='att1',
+ sort_limit=self.upper * 3)
+ self.assertEqual(len(a), 100)
+ for x in range(99):
+ self.assertTrue(a[x].num < a[x + 1].num)
+
+ def test_sort_on_two_big_limit_reverse(self):
+ a = self._catalog(sort_on=('att1', 'num'), att1='att1',
+ sort_limit=self.upper * 3, sort_order='reverse')
+ self.assertEqual(len(a), 100)
+ for x in range(99):
+ self.assertTrue(a[x].num > a[x + 1].num)
+
def testKeywordIndexWithMinRange(self):
a = self._catalog(att3={'query': 'att', 'range': 'min'})
self.assertEqual(len(a), self.upper)
More information about the checkins
mailing list