[Zope] references to zope objects

Tim Hicks tim@sitefusion.co.uk
Tue, 27 Aug 2002 12:48:50 +0100


> As an alternative to using the id attribute, could I use the URL of the
> targetObject as a reference to it? In this case what's the python code to
> 'dereference' the URL?

It sounds like (un)restrictedTraverse() is your friend here.  It takes a url
(although without the host/domain segments I think) and returns the
corresponding object to you.  So, you could do something like:

targetObject = context.restrictedTraverse(path_to_targetObject)
targetObject.APImethod()

hth,

tim