Commit 6da12c56 authored by Jeremy Hylton's avatar Jeremy Hylton

Add __contains__() from ZODB4.

Use 0/1 instead of True/False, since none of the other code uses
True/False.
parent 7cf6f802
...@@ -93,6 +93,15 @@ class fsIndex: ...@@ -93,6 +93,15 @@ class fsIndex:
v=self.get(key, self) v=self.get(key, self)
return v is not 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): def clear(self):
self._data.clear() self._data.clear()
......
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