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

Marco Bizzarri marco.bizzarri at gmail.com
Wed Jul 9 08:22:40 EDT 2008


On Wed, Jul 9, 2008 at 1:53 PM, Sascha Welter <zopelist at betabug.ch> wrote:
> (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
>
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
>


I was not aware of the BTreeFolder2 API. I'll take a look at it right now.

Regards
Marco.




-- 
Marco Bizzarri
http://iliveinpisa.blogspot.com/


More information about the Zope mailing list