[Zope] Re: ObjectManagerItem parent

Maik Jablonski maik.jablonski@uni-bielefeld.de
Wed, 04 Dec 2002 00:10:30 +0100


Clemens Robbenhaar wrote:
> Maik Jablonski writes:
>  > Thierry Florac wrote:
>  > > Given an object accessed directly (for example, through a call to
>  > > Catalog().getObject()), how can I get access to his parent folder in a
>  > > Python script or a Zope product ??  What the property or method name
>  > > pointing to the folder the object ?
>  > 
>  > try:
>  > 
>  > .aq_parent
> 
>  Well, in a Zope product on the file system code.
> 
> Maybe even '.aq_inner.aq_parent' is better to remove any acquisition
> context?
> (Thierry: You can look this up in the ZopeDevelopers guide, chapter
> Acquisition, if You wonder what this means ;-)

If you want no acquisition context, then .aq_inner.aq_parent is the way 
you should do it,
that's right. But in most cases you want acquisition, I would guess...;-)

>  In a Python script, the aq_* variables are not accessible. 
> One could use an external method or fumble with
> 'getPhysicalPath' and 'restrictedTraverse', which is both somewhat
> cumbersome, however.

Sorry, but that's not true. You can access .aq_parent without problems 
in PythonScripts or DTML. I use it every day.

-mj