[Zope] accessing PARENTS from python???
Casey Duncan
casey.duncan@state.co.us
Mon, 14 Aug 2000 11:43:23 -0600
>Kevin Howe wrote:
>>
>> I am trying to access the PARENT of an object in a python class of mine.
>> I want to use the absolute_url() of the parent in a variable.
>>
>> I though it could be done the following way, but got an error:
>>
>> parent=self.PARENTS[0]
>> aurl = parent.absolute_url()
>>
>> I then tried using REQUEST. It works, but doesn't give the correct
>> information. Instead of giving me the parent of the current
object(self),
>> it gives the parent of the DTML page in which the object was called.
>>
>> parent=self.REQUEST.PARENTS[0]
>> aurl = parent.absolute_url()
>>
>> How do you resolve the PARENT object of an object?
>
>you might want to try an alternative method using acquisition
>
>aurl = self.aq_parent.absolute_url()
>
>Kapil
This should also work:
aurl = self.getParentNode().absolute_url()