[Zope-CVS] CVS: Products/BTreeFolder2 - BTreeFolder2.py:1.21 CHANGES.txt:1.3

Shane Hathaway shane at zope.com
Mon Feb 9 15:59:05 EST 2004


Update of /cvs-repository/Products/BTreeFolder2
In directory cvs.zope.org:/tmp/cvs-serv8546

Modified Files:
	BTreeFolder2.py CHANGES.txt 
Log Message:
Renamed hasObject to has_key, keeping the old name as an alias.

This fixes a conflict with another product.  Also made it possible to
subclass the BTreeFolder2 tests.


=== Products/BTreeFolder2/BTreeFolder2.py 1.20 => 1.21 ===
--- Products/BTreeFolder2/BTreeFolder2.py:1.20	Mon Jan 26 16:57:11 2004
+++ Products/BTreeFolder2/BTreeFolder2.py	Mon Feb  9 15:58:34 2004
@@ -318,9 +318,8 @@
         return self._count()
 
 
-    security.declareProtected(access_contents_information,
-                              'hasObject')
-    def hasObject(self, id):
+    security.declareProtected(access_contents_information, 'has_key')
+    def has_key(self, id):
         """Indicates whether the folder has an item by ID.
         """
         return self._tree.has_key(id)
@@ -398,7 +397,7 @@
 
 
     def _checkId(self, id, allow_dup=0):
-        if not allow_dup and self.hasObject(id):
+        if not allow_dup and self.has_key(id):
             raise BadRequestException, ('The id "%s" is invalid--'
                                         'it is already in use.' % id)
 
@@ -408,7 +407,7 @@
         if v is not None: id=v
 
         # If an object by the given id already exists, remove it.
-        if self.hasObject(id):
+        if self.has_key(id):
             self._delObject(id)
 
         self._setOb(id, object)
@@ -447,10 +446,12 @@
 
     # Aliases for mapping-like access.
     __len__ = objectCount
-    has_key = hasObject
     keys = objectIds
     values = objectValues
     items = objectItems
+
+    # backward compatibility
+    hasObject = has_key
 
     security.declareProtected(access_contents_information, 'get')
     def get(self, name, default=None):


=== Products/BTreeFolder2/CHANGES.txt 1.2 => 1.3 ===
--- Products/BTreeFolder2/CHANGES.txt:1.2	Mon Jan 26 16:57:11 2004
+++ Products/BTreeFolder2/CHANGES.txt	Mon Feb  9 15:58:34 2004
@@ -3,6 +3,9 @@
   - ConflictError was swallowed by _delObject. This could break code
     expecting to do cleanups before deletion.
 
+  - Renamed hasObject() to has_key().  hasObject() conflicted with
+    another product.
+
 Version 1.0
 
   - BTreeFolder2s now use an icon contributed by Chris Withers.
@@ -14,4 +17,3 @@
 Version 0.5.1
 
   - Fixed the CMFBTreeFolder constructor.
-




More information about the Zope-CVS mailing list