[Zope-dev] Globally unique id's in Zope in a new way

Tres Seaver tseaver@palladion.com
Thu, 09 Mar 2000 15:24:53 -0600


Jason Spisak wrote:
> 
> So this is only a Win32 module?
> 
> Tres Seaver writes:
> 
> > "James W. Howe" <jwh@allencreek.com> wrote:
> > >
> > > At 07:49 PM 3/8/00 -0500, Jason Spisak wrote:
> > > >Zopsters,
> > > >
> > > >I use the Catalog for quite a bit of jumping around the ZODB, and have a
> > > >30,000 plus objects in a system.  I like the idea of not having to worry
> > > >about id's conflicting with other numbers that might appear (invoice
> > > >numbers, employee numbers, etc...) so I don't like to use a counter for
> > > >ids.  [...]
> > >
> > > I have the same problem.  I want to automatically create objects and I'm
> > > currently using the time method.  When I bulk add objects, I would get a
> > > collision on the time value, so I simply remembered the last id and added 1
> > > to that value.  It works for my current needs, but I wish Zope provided a
> > > standard mechanism for generating unique id's.
> > >
> > > For example, it would actually be nice if Zope provided an implementation
> > > of UUID (called GUID by Microsoft).  A UUID is a guaranteed unique 64-bit
> > > value.  It's used in COM, CORBA and other systems which need to have
> > > automatically generated guaranteed unique values.  The nice thing about
> > > UUID's is that they are guaranteed to be unique network wide.  In other
> > > words, you (supposedly) can't generate a UUID which would ever conflict
> > > with a UUID that I generated.  It does this by an algorithm which takes
> > > into account things like time-of-date, network card address, etc.  I don't
> > > have the details on the algorithm but I know it is publically
> > > available.  It would probably best be implemented at the C level.
> > >
> > > Just an idea.
> >
> > On Win32, this is trivial in Python::
> >
> >   import pywintypes
> >   guid = pywintypes.CreateGuid()
> >   return str( guid )
> >
> > I *think* DCE RPC has a cognate function, uuid_create(), but I don't have
> > documentation for it (Sun RPC probably has a similar call). Hmmm, a search of
> > the Vaults of Parnassus (http://www.vex.net/parnassus) doesn't show any existing
> > wrapper for either major flavor of RPC.

pywintypes is one of the Mark Hammond's Win32 extensions -- mostly they are
pythonified wrappers around various useful Win32 APIs.  In at least one case
(the popen() call), Mark has a working version, while the version in the
standard Python "os" module is broken on Win32.  Mark also provides tools for
building COM clients and servers with Python.

Mark's extensions are at:

  http://starship.python.net/crew/mhammond/win32/Downloads.html

-- 
=========================================================
Tres Seaver         tseaver@palladion.com    713-523-6582
Palladion Software  http://www.palladion.com