[Zope-Checkins] SVN: Zope/trunk/src/Products/ZCatalog/ Fixed a problem with incomplete plan surfaced by the CMF tests
Hanno Schlichting
hannosch at hannosch.eu
Mon Aug 2 17:49:57 EDT 2010
Log message for revision 115391:
Fixed a problem with incomplete plan surfaced by the CMF tests
Changed:
U Zope/trunk/src/Products/ZCatalog/Catalog.py
U Zope/trunk/src/Products/ZCatalog/plan.py
-=-
Modified: Zope/trunk/src/Products/ZCatalog/Catalog.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/Catalog.py 2010-08-02 21:07:45 UTC (rev 115390)
+++ Zope/trunk/src/Products/ZCatalog/Catalog.py 2010-08-02 21:49:57 UTC (rev 115391)
@@ -514,7 +514,13 @@
if not plan:
plan = self._sorted_search_indexes(query)
+ indexes = self.indexes.keys()
for i in plan:
+ if i not in indexes:
+ # We can have bogus keys or the plan can contain index names
+ # that have been removed in the meantime
+ continue
+
index = self.getIndex(i)
_apply_index = getattr(index, "_apply_index", None)
if _apply_index is None:
Modified: Zope/trunk/src/Products/ZCatalog/plan.py
===================================================================
--- Zope/trunk/src/Products/ZCatalog/plan.py 2010-08-02 21:07:45 UTC (rev 115390)
+++ Zope/trunk/src/Products/ZCatalog/plan.py 2010-08-02 21:49:57 UTC (rev 115391)
@@ -287,6 +287,10 @@
def stop(self):
self.end_time = time.time()
self.duration = self.end_time - self.start_time
+ # Make absolutely sure we never omit query keys from the plan
+ for key in self.query.keys():
+ if key not in self.benchmark.keys():
+ self.benchmark[key] = Benchmark(0, 0, 0, False)
PriorityMap.set_entry(self.cid, self.key, self.benchmark)
self.log()
More information about the Zope-Checkins
mailing list