[Zope] Generating unique keys

Stuart 'Zen' Bishop zen@cs.rmit.edu.au
Sat, 9 Oct 1999 16:28:27 +1000 (EST)


I need to generate unique ID's for objects I'll be creating from DTML. This
of course needs to be thread safe. Although I can't do this out of the box
from within DTML (that I know of), I could get thread safety using an
external method, or a persistant object written in Python, and using locks 
provided by the Python thread module. I think a persistant object (lets call
it ZSequence) would be best.

However, all this falls down if we want the code to run under ZEO in the
future. And using a SEQUENCE in my Oracle database might work for me, but 
I want avoid using my RDBMS if possible.

Can I use the Transaction system? I don't want to do a full commit, as this
would have unknow effects on whatever is referencing this object. Can I
commit changes to a dirty object, without affecting the rest of the 
transaction? (I've looked at cPersistence.c, which did nothing but remind we
why I havn't programmed in C for years :-) )

Any thoughts? Have I missed some fundamental ZODB concept that solves
these issues?

 ___
   //     Zen (alias Stuart Bishop)     Work: zen@cs.rmit.edu.au
  // E N  Senior Systems Alchemist      Play: zen@shangri-la.dropbear.id.au
 //__     Computer Science, RMIT 	 WWW: http://www.cs.rmit.edu.au/~zen