[Zope-CVS] CVS: Products/BTreeFolder2 - BTreeFolder2.py:1.2

Shane Hathaway shane@cvs.zope.org
Wed, 8 May 2002 13:18:53 -0400


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

Modified Files:
	BTreeFolder2.py 
Log Message:
Some corrections and more tests


=== Products/BTreeFolder2/BTreeFolder2.py 1.1.1.1 => 1.2 ===
 from zLOG import LOG, ERROR, WARNING
 from Products.ZCatalog.Lazy import LazyMap
-from ComputedAttribute import ComputedAttribute
+#from ComputedAttribute import ComputedAttribute
 
 
 manage_addBTreeFolderForm = DTMLFile('folderAdd', globals())
@@ -43,8 +43,8 @@
     """Adds a new BTreeFolder object with id *id*.
     """
     id = str(id)
-    title = str(title)
-    ob = BTreeFolder(id, title)
+    ob = BTreeFolder2(id)
+    ob.title = str(title)
     dispatcher._setObject(id, ob)
     ob = dispatcher._getOb(id)
     if REQUEST is not None:
@@ -358,11 +358,11 @@
         return self._getOb(name, default)
 
 
-    # Utility for generating IDs.
+    # Utility for generating unique IDs.
 
     security.declareProtected(access_contents_information,
                               'generateUniqueId')
-    def generateUniqueId(self, prefix='item', suffix=''):
+    def generateId(self, prefix='item', suffix=''):
         """Returns an ID not used yet by this folder.
 
         The ID is unlikely to collide with other threads and clients.
@@ -374,10 +374,10 @@
         while 1:
             id = '%s%d%s' % (prefix, n, suffix)
             if n % 4000 == 0 or tree.has_key(id):
-                n = randint(1, 2000000000)
+                n = randint(1, 999999999)
             else:
                 break
-        self._v_nextid = n
+        self._v_nextid = n + 1
         return id