[Zope] Parents id of a specific object

Dieter Maurer dieter@handshake.de
Wed, 18 Jul 2001 21:18:57 +0200 (CEST)


Benoit DOMINIAK writes:
 > Is there a way to get the id of an object's parent (container) ? I've tryed 
 > :
 > <dtml-with "_.getitem(object)">
 > <dtml-var "PARENTS[0].getId()">
 > </dtml-with>
 > 
 > but I always get the id of the ancestor of the published object. Just like 
 > the Zope book said !!
An External Method (!):

   def getContainer(object):
     try: return object.aq_inner.aq_parent
     except AttributeError: return None


Dieter