[Zope3-dev] Re: New METAL extension feature
Tonico Strasser
contact_tonico at yahoo.de
Mon Nov 22 15:10:49 EST 2004
Shane Hathaway wrote:
> On the Zope 3 trunk, I have enhanced METAL to allow use-macro and
> define-macro in the same tag.
>
> I'm writing a skin that customizes the Rotterdam skin. The Rotterdam skin
> is already customizable in the sense that it has a lot of
> metal:define-slot directives, but I need my skin to replace certain slots
> in the main page macro while allowing the rest to be filled by non-skin
> templates.
>
> I figured out that I could achieve what I want in two steps: first I had
> to allow a macro to extend another macro, overriding inherited slot
> fillers, then I had to allow a layer to get a macro defined in an
> inherited layer. I achieved the second part by registering a view that
> finds inherited macros, but the first part was elusive until I figured out
> that I could get what I want from TAL without adding any new directives.
> Adding the macro extension feature was fairly easy, but getting the metal
> source rendering to work correctly was hard.
>
> I checked in my changes to TAL this morning. The only TAL language change
> is that you can now use both metal:define-macro and metal:use-macro in a
> single tag; this used to be an error. Macro extension is much like
> defining a class that inherits from a single base class. The slots are
> like methods that can be overridden. You can also extend an extended
> macro. I think many people will find this useful.
Good news :)
A suggestion: to avoid confusion about why metal:define-macro works
different when used together with metal:use-macro I would call it
metal:extend-macro or similar.
<html metal:extend-macro="context/@@coolskin_macros/page">
Tonico
More information about the Zope3-dev
mailing list