[ZPT] Using PTFiles in Python Products
Michael R. Bernstein
10 Jul 2002 12:31:45 -0700
On Wed, 2002-07-10 at 10:42, Dieter Maurer wrote:
> 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").
Hmm. I can easily shift the macros in question to a 'library' template,
but this seems somewhat less than ideal.
> Otherwise, you can try to emulate ".." by "aq_parent".
> It will work in simple cases (but give the wrong result in more
> complex ones).
Thanks for the suggestion Dieter, but, well... Ick. Use of aq_parent in
a Page Template is *far* too ugly for me to consider.
I guess I had been under the impression that /../ notation was already
supported by TALES path expressions (though I have no idea where I
picked up the notion). Is this planned for a future release?