[Zope] Best policy to assign policy to assign ids to objects inside BTreeFolder2

Sascha Welter zopelist at betabug.ch
Wed Jul 9 07:53:35 EDT 2008


(Mon, Jul 07, 2008 at 02:52:57PM +0200) Marco Bizzarri wrote/schrieb/egrapse:
> I need to create a number of objects inside a BTreeFolder2 container.
> 
> I would like to minimize the chances of conflicts, so I'm exploring
> possibilities to assign ids; up to now I've found the following:
> 
> - timestamps
> - random numbers
> 
> What is the best choice to reduce the chances of conflicts?

How about the API that BTreeFolder2 provides?

Look for generateId(). In my experience it works quite well. It just
counts integers up, but resolves conflicts. It gives you the ability to
assign prefixes and suffixes.

Regards,

Sascha



More information about the Zope mailing list