Parents id of a specific object
Hi, 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 !! Any idea ? _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
Try this().aq_parent.getId()
From: "Benoit DOMINIAK" <koubonline@hotmail.com> Reply-To: benoit.dominiak@makinacorpus.com Date: Wed, 18 Jul 2001 15:02:43 +0200 To: zope@zope.org Subject: [Zope] Parents id of a specific object
Hi, 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 !!
Any idea ?
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
On Wed, 18 Jul 2001, Benoit DOMINIAK wrote:
Hi, 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>
PARENTS is part of the request, not part of the current object. aq_parent.getId() will get what you want hth, -- Joel Burton <jburton@scw.org> Director of Information Systems, Support Center of Washington
participants (4)
-
Benoit DOMINIAK -
Dieter Maurer -
Joel Burton -
marc lindahl