[z3-five] getParentNode() returns View class!

Stefan H. Holek stefan at epy.co.at
Tue Sep 26 18:47:38 CEST 2006


I am quite sure this is a bug, but it has been there forever (since I  
know Zope) and nobody ever cared enough.

getParentNode gives you self.aq_parent which is not (necessarily) the  
container, but the URL parent. If you want an object's container you  
have to use self.aq_inner.aq_parent.

Stefan


On 26. Sep 2006, at 16:59, Suresh V. wrote:

> I have a method in y content class that calls getParentNode().
>
>      def get_output(self):
>          p = self.getParentNode()
>          print p.getId()
>
> When called from a method in the View class:
>
>      context = self.context
>      context.get_output()
>
> getParentNode returns the View class and I get:
>
>      AttributeError: getId
>
> What I want is the parent object in the Zope hierarchy.
>
> Is this a bug? If not how do I get what I want?
>
> Suresh

--
Anything that, in happening, causes itself to happen again,
happens again.  --Douglas Adams




More information about the z3-five mailing list