[Zope] Python question

Phil Harris phil@harris-family.info
Mon, 18 Mar 2002 16:10:38 -0000


p = context.aq_parent
while p.meta_type != "Folder":
  p = p.aq_parent
return p

----- Original Message ----- 
From: "Tom Nixon" <tom.nixon@aim23.com>
To: <zope@zope.org>
Sent: Monday, March 18, 2002 4:03 PM
Subject: [Zope] Python question


> I need a python script that will return the first folder in the
> hierarchy above the current object. I have got this far, but it looks
> like content_type isn't the property I need. Can anyone help me out?
> Also, is there somewhere I can find a reference for this sort of thing
> so I don't have to keep posting to the list?
> 
> p = context.aq_parent
> while p.content_type != "Folder":
>   p = p.aq_parent
> return p
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )