[Zope-CVS] CVS: Products/BTreeFolder2 - BTreeFolder2.py:1.7
Shane Hathaway
shane@cvs.zope.org
Thu, 23 May 2002 13:17:15 -0400
Update of /cvs-repository/Products/BTreeFolder2
In directory cvs.zope.org:/tmp/cvs-serv17264
Modified Files:
BTreeFolder2.py
Log Message:
More forcefully prevented subobject overwrites and arranged for meta_type indexes to be pruned automatically.
=== Products/BTreeFolder2/BTreeFolder2.py 1.6 => 1.7 ===
if tree.has_key(name):
raise KeyError, (
- 'The BTreeFolder2 already has an item named "%s".'
+ 'There is already an item named "%s".'
% name)
tree[name] = aq_base(value)
count.change(1)
@@ -137,6 +137,8 @@
"""Stores the object in the BTree.
"""
tree = self._tree
+ if tree.has_key(id):
+ raise KeyError, 'There is already an item named "%s".' % id
tree[id] = object
self._count.change(1)
# Update the meta type index.
@@ -161,6 +163,10 @@
ids = mti.get(meta_type, None)
if ids is not None and ids.has_key(id):
del ids[id]
+ if not ids:
+ # Removed the last object of this meta_type.
+ # Prune the index.
+ del mti[meta_type]
security.declareProtected(view_management_screens, 'getBatchObjectListing')