[Zope3-dev] Re: ZPT Macros
Tonico Strasser
contact_tonico at yahoo.de
Mon Oct 10 17:47:11 EDT 2005
>>Ok, I don't really understand what this all means. I have trivial use
>>cases and don't understand why everything has to be so complicated.
Roger Ineichen schrieb:
> It's only because the macros registration via ZCML and the TALES
> expression isn't the right concept for what you where shoing at the
> sprint.
>
> For your idea, you need to implement a custom page template where
> provides a macros namspace. Then you can call macros in TAL like:
>
> <metal:block use-macro="macros/myMacro" />
>
> If we like to use the standard page template we don't have this
> "macro" namespace and need a TALES expression for the macro
> lookup like:
>
> <metal:block use-macro="macros:myMacro" />
>
> Right now without a macros ZCML directive we use macros via a
> additional page (view) hook like:
>
> <metal:block use-macro="context/@@macros/myMacro" />
>
> In this case the "@@macros" is a view registred with a own python
> class inherited from the class Macros. Most the time called
> StandardMacros (see Rotterdam skin).
>
> I only propose to get rid of this additional python class
> implementation and view registration and like to offer a
> ZCML directive and a TALES namespace explicit for macros.
Ok, got it :)
You want to support browser:page's template="some.pt" which is a
ViewPageTemplateFile and has an immutable namespace when used as view
from a browser:page directive.
Interesting, I have been believing that it is straighter to pass a dict
to a page template than creating a new expression type. Thanks for the
explanation.
Tonico
More information about the Zope3-dev
mailing list