[z3-five] (re)using zpt macros from view page templates
Chris Withers
chris at simplistix.co.uk
Mon Jan 29 23:55:06 CET 2007
Philipp von Weitershausen wrote:
>> my_macro.pt
>> -----------
>> <html metal:define-macro="template">
>> ...etc...
>> <metal:x define-slot="foo"/>
>> ...etc...
>> </html>
>
> <browser:page name="mymacro" template="my_macro.pt" ... />
Okay, but what interface do I bind it to? *, so it's available on all
objects? It just seems a bit wasteful, a view is essentially a
multiadapter for a context and a request. A macro needs neither context
nor request, and feels a lot close to a utility to me.
I want to get it from one define place, but only be accessible either
from trusted code, or by people who are allowed to view it.
> Anyway, it looks like lots of unnecessary typing. Just register the
> tempalte with the macro as a page and access the macro as outlined above.
Well, my way wasn't much typing, but I hit a problem.
<browser:page name="mymacro" template="my_macro.pt" ... /> seems to have
a TAL version of 1.5.
Products.Five.browser.pagetemplatefile.ViewPageTemplateFile seems to
instantiate templates with a TAL version of 1.6.
So, if I try and use my macro from a normal Five view, I get a
METALError: macro 'mymacro' has incompatible version '1.6'.
Why is that? How can I fix it and get them both to use the same TAL version?
cheers,
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the z3-five
mailing list