[ZPT] Using PTFiles in Python Products

Dieter Maurer dieter@handshake.de
Wed, 10 Jul 2002 19:42:07 +0200

Michael R. Bernstein writes:
 > ...
 > How do I access the macros defined in a PTFile defined on an object from
 > a PTFile defined on a child object?
 > I have an index_html PTFile attribute defined on a container object, and
 > another index_html PTFile attribute defined on a subobject. I would like
 > to access a macro defined on the parent object's index_html.
 > The following does not seem to work:
 > <p metal:use-macro="here/../index_html/macros/manage_navbar">Navbar goes
 > here</p>
 > which raises an 'Undefined' error.
You can try to rely on acquisition (this usually works, but may
not work with the ubiquitous "index_html").

Otherwise, you can try to emulate ".." by "aq_parent".
It will work in simple cases (but give the wrong result in more
complex ones).

The "Acquisition" section of


may help you to understand the issues. You will not find "aq_parent"
there. It is the "parent" (or "context") selector of acquisition