[Zope3-checkins] CVS: Zope3/src/zope/app/container - btree.py:1.3 sample.py:1.5
Jeremy Hylton
jeremy@zope.com
Mon, 30 Dec 2002 15:43:49 -0500
Update of /cvs-repository/Zope3/src/zope/app/container
In directory cvs.zope.org:/tmp/cvs-serv14108/app/container
Modified Files:
btree.py sample.py
Log Message:
Rename _Container__newData() to _newContainerData().
=== Zope3/src/zope/app/container/btree.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/container/btree.py:1.2 Wed Dec 25 09:12:46 2002
+++ Zope3/src/zope/app/container/btree.py Mon Dec 30 15:43:49 2002
@@ -31,7 +31,13 @@
__implements__ = SampleContainer.__implements__, Persistent.__implements__
- def _Container__newData(self):
+ # XXX It appears that BTreeContainer uses SampleContainer only to
+ # get the implementation of setObject(). All the other methods
+ # provided by that base class are just slower replacements for
+ # operations on the BTree itself. It would probably be clearer to
+ # just delegate those methods directly to the btree.
+
+ def _newContainerData(self):
"""Construct an item-data container
Subclasses should override this if they want different data.
=== Zope3/src/zope/app/container/sample.py 1.4 => 1.5 ===
--- Zope3/src/zope/app/container/sample.py:1.4 Fri Dec 27 14:22:50 2002
+++ Zope3/src/zope/app/container/sample.py Mon Dec 30 15:43:49 2002
@@ -22,9 +22,9 @@
$Id$
"""
-from zope.app.interfaces.container import IContainer
from types import StringTypes
-from zope.app.interfaces.container import UnaddableError
+
+from zope.app.interfaces.container import IContainer, UnaddableError
class SampleContainer(object):
"""Sample container implementation suitable for testing.
@@ -37,9 +37,9 @@
__implements__ = IContainer
def __init__(self):
- self.__data = self._Container__newData()
+ self.__data = self._newContainerData()
- def _Container__newData(self):
+ def _newContainerData(self):
"""Construct an item-data container
Subclasses should override this if they want different data.
@@ -49,7 +49,6 @@
"""
return {}
-
def keys(self):
'''See interface IReadContainer'''
return self.__data.keys()
@@ -91,10 +90,11 @@
unicode(key)
except UnicodeError:
bad = True
- else: bad = True
+ else:
+ bad = True
if bad:
- raise TypeError(("'%s' is invalid, the key must be an " +
- "ascii or unicode string") % key)
+ raise TypeError("'%s' is invalid, the key must be an "
+ "ascii or unicode string" % key)
if len(key) == 0:
raise ValueError("The key cannot be an empty string")
self.__data[key] = object