[Zope] Generating unique keys

Pavlos Christoforou pavlos@gaaros.msrc.sunysb.edu
Sun, 10 Oct 1999 18:52:23 -0400 (EDT)


On Sun, 10 Oct 1999, Michel Pelletier wrote:

> Stuart 'Zen' Bishop wrote:
> > 
> > I need to generate unique ID's for objects I'll be creating from DTML. This

> request, guarenteed (or at least odds in the billions to one against it
> not being) unique across a set of machines which synchronize via Network
> Time Protocol.
> 
> -Michel
> 

There are a lot of ways of doing this and of course it depends on the
application. Once when I needed to do something similar I generated an
md5 checksum out of a property of the Zope object and its parent
folder id. In my application such a combination was unique. If you have
some property of your object (in combination with some other info perhaps)
that is quaranteed to be unique you can use the md5 module that comes
standard with python to generate a unique id.


Pavlos