[Zope3-checkins] CVS: Zope3/src/zope/app/container - btree.py:1.8
Stephan Richter
srichter at cosmos.phy.tufts.edu
Wed Mar 17 11:38:42 EST 2004
Update of /cvs-repository/Zope3/src/zope/app/container
In directory cvs.zope.org:/tmp/cvs-serv3432/src/zope/app/container
Modified Files:
btree.py
Log Message:
Fixed issue 134. Added BTreeContainer tests.
=== Zope3/src/zope/app/container/btree.py 1.7 => 1.8 ===
--- Zope3/src/zope/app/container/btree.py:1.7 Fri Feb 20 17:02:28 2004
+++ Zope3/src/zope/app/container/btree.py Wed Mar 17 11:38:12 2004
@@ -46,3 +46,23 @@
has_key, keys, items, and values methods.
"""
return OOBTree()
+
+ def __contains__(self, key):
+ '''See interface IReadContainer
+
+ Reimplement this method, since has_key() returns the key if available,
+ while we expect True or False.
+
+ >>> c = BTreeContainer()
+ >>> "a" in c
+ False
+ >>> c["a"] = 1
+ >>> "a" in c
+ True
+ >>> "A" in c
+ False
+ '''
+ return key in self._SampleContainer__data
+
+ has_key = __contains__
+
More information about the Zope3-Checkins
mailing list