[Checkins] SVN: zc.catalog/trunk/src/zc/catalog/ add a len on the
extent
Gary Poster
gary at zope.com
Tue Jun 5 07:39:11 EDT 2007
Log message for revision 76354:
add a len on the extent
Changed:
U zc.catalog/trunk/src/zc/catalog/extentcatalog.py
U zc.catalog/trunk/src/zc/catalog/extentcatalog.txt
U zc.catalog/trunk/src/zc/catalog/interfaces.py
-=-
Modified: zc.catalog/trunk/src/zc/catalog/extentcatalog.py
===================================================================
--- zc.catalog/trunk/src/zc/catalog/extentcatalog.py 2007-06-05 09:49:05 UTC (rev 76353)
+++ zc.catalog/trunk/src/zc/catalog/extentcatalog.py 2007-06-05 11:39:10 UTC (rev 76354)
@@ -46,6 +46,9 @@
def BTreeAPI(self):
return sys.modules[self.set.__class__.__module__]
+ def __len__(self):
+ return len(self.set)
+
def add(self, uid, obj):
self.set.insert(uid)
Modified: zc.catalog/trunk/src/zc/catalog/extentcatalog.txt
===================================================================
--- zc.catalog/trunk/src/zc/catalog/extentcatalog.txt 2007-06-05 09:49:05 UTC (rev 76353)
+++ zc.catalog/trunk/src/zc/catalog/extentcatalog.txt 2007-06-05 11:39:10 UTC (rev 76354)
@@ -65,6 +65,11 @@
>>> sorted(extent) == sorted(index.uids) == matches
True
+We can get the size of the extent.
+
+ >>> len(extent)
+ 100
+
Unindexing an object that is in the catalog should simply remove it from the
catalog and index as usual.
Modified: zc.catalog/trunk/src/zc/catalog/interfaces.py
===================================================================
--- zc.catalog/trunk/src/zc/catalog/interfaces.py 2007-06-05 09:49:05 UTC (rev 76353)
+++ zc.catalog/trunk/src/zc/catalog/interfaces.py 2007-06-05 11:39:10 UTC (rev 76354)
@@ -49,6 +49,9 @@
def clear():
"""Remove all uids from set."""
+ def __len__():
+ """the number of items in the extent."""
+
def __iter__():
"""return iterator of uids in set"""
More information about the Checkins
mailing list