[Zope-CVS] CVS: Products/BTreeFolder2 - BTreeFolder2.py:1.11
Casey Duncan
casey@zope.com
Mon, 1 Jul 2002 11:12:57 -0400
Update of /cvs-repository/Products/BTreeFolder2
In directory cvs.zope.org:/tmp/cvs-serv14885
Modified Files:
BTreeFolder2.py
Log Message:
Added optional "rand_ceiling" argument to generateId method to give the caller more control over the generated id. Default behavior is unchanged.
=== Products/BTreeFolder2/BTreeFolder2.py 1.10 => 1.11 ===
security.declareProtected(access_contents_information, 'generateId')
- def generateId(self, prefix='item', suffix=''):
+ def generateId(self, prefix='item', suffix='', rand_ceiling=999999999):
"""Returns an ID not used yet by this folder.
The ID is unlikely to collide with other threads and clients.
@@ -393,7 +393,7 @@
id = '%s%d%s' % (prefix, n, suffix)
if not tree.has_key(id):
break
- n = randint(1, 999999999)
+ n = randint(1, rand_ceiling)
self._v_nextid = n + 1
return id