[Zope-dev] Unique and Contant object IDs

Toby Dickenson tdickenson@geminidataloggers.com
Wed, 25 Oct 2000 12:38:29 +0100


> Yeah, I'd love an ID I could use to grab an object no matter how often
> it was used.

I suspect you will have to build this yourself. Store a sufficiently random
id inside your objects when they are created, and use a ZCatalog to index
them.

> Why wouldn't the following work though:
> 
> ...in a class method...
> 
> self.theobject = theObject
> 
> ...where theObject is something I want a reference to and self is a
> persistent class...

theObject would need to be persistent too. This has a number of
characteristics that I would class as problems, but may be exactly what you
want:

* theObject will have different acquisuition context when accessed through
its main path, and through self.theobject. This means different:
   * security
   * absolute_url
   * configuration obtained through acquisition. What if theObject is
CatalogAware?

* theObject isnt removed from the database when it is deleted from its
folder; this other reference keeps it alive.