[Zope-CMF] Finding objects parent

Dieter Maurer dieter@handshake.de
Mon, 10 Sep 2001 22:57:39 +0200 (CEST)


marc lindahl writes:
 > > I have tried with PARENTS[0] but that gives me the portal instance itself ...
 > > :-(
 > 
 > I thought PARENTS[0] was demoted in preference for aq_parent?
They may be quite different:

  "PARENTS" is defined during traversal. It is constant
  for the complete request.
  "aq_parent" on the other hand depends on the DTML namespace.

  Assume, for example, "f" is a folder and "m" a DTML method
  containing a reference to "aq_parent".

  In the request ".../f/m", "PARENTS[0]" is "f", but
  "aq_parent" is "f"s parent.
  If, on the other hand, "m" is a DTML Document, then
  "aq_parent" is also "f".

You may already see, it is quite difficult to determine,
what "aq_parent" is. If necessary, I could provide more examples.


Dieter