[ZDP] FAQ update

kamon.ayeva@bureauveritas.com kamon.ayeva@bureauveritas.com
Fri, 24 Mar 2000 18:27:35 +0100


Hi,

Some time ago I found the following answer from a discussion on Zope-dev,
but I cannot tell who where the two persons. I reformulated the answer a
little bit for being inserted in the FAQ, but I would like to see if some
other people can complete, give more explanation before.

>>>>
Question: How do I make a Zope object reference another object ?

Answer:
If your goal is to have a reference to a *location*, as opposed
to a specific object, i.e. if the object is deleted or moved and replaced
by another one with the same name, the reference should refer to the new
object, do this : Store the absoulte_url() of the referenced object, and
run this through a referencing method whenever you want to grab it.

If you want the reference to follow the object around if it's renamed, by
climbing up the path to it instead of just grabbing it directly, do this:
Store the object as an attribute of the referencing object.  This has to be
done (I think) from an External Method, since you *aren't* setting a
property. You do something like "self.fooref = self.path.to.other.aq_base"
which DTML doesn't allow.
>>>>

Regards,
Kamon