Zopsters, Is there a way to genereate globally unique object ids for use with a Zope app. I notices the ZClasses has this sort of thing. I used to use a counter property of the root folder and call an update with creation of an object like so, <!--#call "PARENTS[-2].manage_changeProperties(counter=counter+1)"-->, but now with concurrency that's not *really* safe, plus this code doesn't seem to work at a certain level in the hirearchy. It doesn't add to the counter. Any suggestions on a glabally unique object ids. Jason Spisak webmaster@mtear.com
Jason Spisak wrote:
Zopsters,
Is there a way to genereate globally unique object ids for use with a Zope app.
Yes. Uh sort of. What do you want to use this for?
I notices the ZClasses has this sort of thing.
Right.
I used to use a counter property of the root folder and call an update with creation of an object like so, <!--#call "PARENTS[-2].manage_changeProperties(counter=counter+1)"-->, but now with concurrency that's not *really* safe,
Why not? Jim -- Jim Fulton mailto:jim@digicool.com Python Powered! Technical Director (888) 344-4332 http://www.python.org Digital Creations http://www.digicool.com http://www.zope.org Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email address may not be added to any commercial mail list with out my permission. Violation of my privacy with advertising or SPAM will result in a suit for a MINIMUM of $500 damages/incident, $1500 for repeats.
Jim, Alexander had a thread going about this on zope@zope.org and it looks like Michel has answered to the effect that a persistant object like a property is thread safe. I just discovered that the reason it wasn't adding to the counter was possibly bug related and due to a <!--#call "Catalog.manage_Catalogobject()"--> call. It seemed to not allow the DTML page to process, but didn't give me a traceback, it just processed the rest of the page. It works now that I use and external method for Cataloging. I'm going to use the counter because it's not complex, and I just need a way of knowing that there won't be an already exists error when creating objects. I want object id's not to be the responsibility of the user. Autocreation of the id's seems easiest this way. Although globally unique identifiers have more power when doing the kind of Cataloging, referenceing stuff I'm doing. How hard would it be to implement? All my best (sorry for the long reply) Jason Spisak webmaster@mtear.com
participants (2)
-
Jason Spisak -
Jim Fulton