[Zodb-checkins] CVS: ZODB3/ZODB - fsIndex.py:1.4

Jeremy Hylton jeremy@zope.com
Tue, 3 Dec 2002 13:45:17 -0500


Update of /cvs-repository/ZODB3/ZODB
In directory cvs.zope.org:/tmp/cvs-serv23466

Modified Files:
	fsIndex.py 
Log Message:
Add __contains__() from ZODB4.

Use 0/1 instead of True/False, since none of the other code uses
True/False.


=== ZODB3/ZODB/fsIndex.py 1.3 => 1.4 ===
--- ZODB3/ZODB/fsIndex.py:1.3	Wed Aug 14 18:07:09 2002
+++ ZODB3/ZODB/fsIndex.py	Tue Dec  3 13:45:16 2002
@@ -93,6 +93,15 @@
         v=self.get(key, self)
         return v is not self
 
+    def __contains__(self, key):
+        tree = self._data.get(key[:6])
+        if tree is None:
+            return 0
+        v = tree.get(key[6:], None)
+        if v is None:
+            return 0
+        return 1
+
     def clear(self):
         self._data.clear()