[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Folder - Folder.py:1.1.2.3
Steve Alexander
steve@cat-box.net
Sun, 24 Feb 2002 18:52:25 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Folder
In directory cvs.zope.org:/tmp/cvs-serv520
Modified Files:
Tag: Zope-3x-branch
Folder.py
Log Message:
Now uses OOBTree rather than {}.
=== Zope3/lib/python/Zope/App/OFS/Folder/Folder.py 1.1.2.2 => 1.1.2.3 ===
from Zope.App.OFS.IContainer import IContainer
import Persistence
+from Persistence.BTrees.OOBTree import OOBTree
from Zope.App.Security.IAttributeRolePermissionManageable \
import IAttributeRolePermissionManageable
@@ -29,30 +30,32 @@
_service_manager = None
def __init__(self):
- # XXX - fix this to use a btree when persistence is online.
- self.data = {}
+ self.data = OOBTree()
def objectIds(self):
"""Return a sequence-like object containing the names
-associated
- with the objects that appear in the folder."""
+ associated with the objects that appear in the folder
+ """
return self.data.keys()
def objectValues(self):
"""Return a sequence-like object containing the objects that
- appear in the folder."""
+ appear in the folder.
+ """
return self.data.values()
def objectItems(self):
"""Return a sequence-like object containing tuples of the form
- (name, object) for the objects that appear in the folder."""
+ (name, object) for the objects that appear in the folder.
+ """
return self.data.items()
def getObject(self, name, default=_RAISE_KEYERROR):
"""Return the named object, or the value of the default
-argument
- if given and the named object is not found. If no default is
- given and the object is not found a KeyError is raised."""
+ argument if given and the named object is not found.
+ If no default is given and the object is not found a
+ KeyError is raised.
+ """
object = self.data.get(name, default)
if object is _RAISE_KEYERROR:
raise KeyError, name
@@ -68,13 +71,11 @@
def setObject(self, name, object):
"""Add the given object to the folder under the given name."""
- self.data = self.data # Signal a change to Persistence
self.data[name] = object
def delObject(self, name):
"""Delete the named object from the folder. Raises a KeyError
if the object is not found."""
- self.data = self.data # Signal a change to Persistence
del self.data[name]
def getServiceManager(self):