[Zope] How to obtain the parent-object from an Zope-object

Dieter Maurer dieter@handshake.de
Fri, 16 May 2003 21:51:58 +0200


Geir B=E6kholt wrote at 2003-5-16 10:33 +0200:
 > On  Fri, 16 May 2003 08:55:23 +0200 GMT (..8:55 where i live(GMT+2) )
 > Wim Bekker asked the Zope mailinglist about the following:
 >  =20
 > WB> How can I obtain the 'parent' object in Zope with python (script)?
 >=20
 > myparent =3D object.aq_parent

That usually works, but not always.

  It may fail, when the object was accessed via acquisition.

The other proposal ("getParentNode") may be more reliable
(as acquisition context might be cut away) but I am not sure
(acquisition rules for a method's "self" are so complex that
I always need to think for hours how they work in a concrete
situation).


Dieter