[Zope-dev] Accessing parent object

Robert Sander zope-dev@beteigeuze.cs.tu-berlin.de
Thu, 24 Feb 2000 14:26:30 +0100


Hi!

Ok, in a recent message I saw self.aq_acquire("some object"), that is extactly 
what I meant and needed. Why are the Acquisition classes so badly documented? 
Acquisition is a .so loadable module (for performance reasons, I presume) and 
I do not want to look into its C code to imagine what is done in Python ...
Searching www.zope.org for "Acquisition" did not reveal anything better.

OK, after disclaiming a little bit, I still have a problem:

from Acquisition import Implicit
from AccessControl.Role import RoleManager
from OFS.Folder import Folder
from Globals import Persistent

class One(Implicit, Persistent, RoleManager, Folder):
    attribute = "Some text or something else"
    def somemethod(self):
        ob = Two()
        self._setObject("id", ob)
        ob.method()

class Two(Implicit, Persistent, RoleManager, Folder):
    def method(self):
        print self.aq_acquire("attribute")

one = One()
one.somemethod()

Leads toward an AttributeError because aq_acquire was not found in Two.method()

Any help is very appreciated.

Greetings
-- 
Robert Sander                                 www.gurubert.de