[Zope] Storing and Using Object references

Tom Jenkins TJenkins@DevIS.com
Thu, 11 Jan 2001 08:04:17 -0500


Thanks for th pointer Shane,
My original attempt with Andy's help was to use the REQUEST's resolve_url.
However, the SiteAccess2 product breaks that method.  I'll try your
suggestions.

Thanks
Tom

-----Original Message-----
From: Shane Hathaway [mailto:shane@digicool.com]
Sent: Wednesday, January 10, 2001 3:11 PM
To: Tom Jenkins
Subject: Re: [Zope] Storing and Using Object references


Tom Jenkins wrote:
> 
> Hello all,
> i have a question and I hope someone can point me in the right direction
> to solve it.  I need one zope object to hold a reference to another zope
> object so the first object can call methods of the second object.  oh,
> these are python classes.
> 
> Example: object 1 is :  /container1/container1a/item1  object 2 is :
> /container2/container2a/item1  object1 needs to hold a reference to
> object2.  I'm really stuck on how to store and access object2 from
> object1.
> 
> any pointers?

I think what you're looking for is getPhysicalPath() and
unrestrictedTraverse().  Store object2.getPhysicalPath(), which returns
a tuple, in object1.  To find object2 again, call
object1.unrestrictedTraverse(stored_physical_path).

Note that this only works in Zope 2.2.x+.

Shane


-------------------------------------------------
Tom Jenkins                       | <xml>
devIS - Development InfoStructure |  Its what you
703.525.6485   tjenkins@devis.com |  you need it 
http://www.devis.com              |  to be </xml>