Commit b493e7f2 authored by Andreas Jung's avatar Andreas Jung

removed 'batch-size' crap (not used inside Zope)

parent e2c73f8b
......@@ -622,12 +622,6 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
kw=m
elif REQUEST: kw=REQUEST
# Make sure batch size is set
if REQUEST and not REQUEST.has_key('batch_size'):
try: batch_size=self.default_batch_size
except AttributeError: batch_size=20
REQUEST['batch_size']=batch_size
# Compute "sort_index", which is a sort index, or none:
if kw.has_key('sort-on'):
sort_index=kw['sort-on']
......@@ -682,4 +676,47 @@ class Catalog(Persistent, Acquisition.Implicit, ExtensionClass.Base):
__call__ = searchResults
def checkConsistency(self):
""" perform some consistency checks on the catalog """
from types import IntType
from BTrees.IIBTree import IISet,difference,intersection
l_data = list(self.data.keys())
l_data.sort()
l_uids = list(self.uids.values())
l_uids.sort()
l_paths = list(self.data.keys())
l_paths.sort()
assert l_data == l_uids
assert l_data == l_paths
for id,idx in self.indexes.items():
if idx.meta_type == 'FieldIndex':
RIDS = IISet()
for key, rids in idx._index.items():
if isinstance(rids,IntType):
RIDS.insert( rids )
else:
map(RIDS.insert , rids.keys())
diff = difference(RIDS, IISet(self.data.keys()))
assert len(diff)==0,'Index %s: problem with forward entries' % id
RIDS = IISet()
for key, rids in idx._index.items():
if isinstance(rids,IntType):
RIDS.insert( rids )
else:
map(RIDS.insert , rids.keys())
diff = difference(RIDS, IISet(self.data.keys()))
assert len(diff)==0,'Index %s: problems with backward entries' % id
class CatalogError(Exception): pass
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment