[Zope-Checkins] SVN: Zope/trunk/src/Products/ZCatalog/Catalog.py Avoid overriding the all keyword and combine sort and reverse calls into one
Hanno Schlichting
hannosch at hannosch.eu
Sun Aug 1 10:42:34 EDT 2010
Log message for revision 115333:
Avoid overriding the all keyword and combine sort and reverse calls into one
Changed:
U Zope/trunk/src/Products/ZCatalog/Catalog.py
-=-
Modified: Zope/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/Catalog.py 2010-08-01 14:19:45 UTC (rev 115332)
+++ Zope/trunk/src/Products/ZCatalog/Catalog.py 2010-08-01 14:42:33 UTC (rev 115333)
@@ -869,15 +869,16 @@
# Concatenate the catalog results into one list and sort it
# Each result record consists of a list of tuples with three values:
# (sortkey, docid, catalog__getitem__)
+ combined = []
if len(results) > 1:
- all = []
for r in results:
- all.extend(r)
+ combined.extend(r)
elif len(results) == 1:
- all = results[0]
+ combined = results[0]
else:
return []
- all.sort()
if reverse:
- all.reverse()
- return LazyMap(lambda rec: rec[2](rec[1]), all, len(all))
+ combined.sort(reverse=True)
+ else:
+ combined.sort()
+ return LazyMap(lambda rec: rec[2](rec[1]), combined, len(combined))
More information about the Zope-Checkins
mailing list