[Zope3-dev] New METAL extension feature

Shane Hathaway shane at hathawaymix.org
Mon Nov 22 12:18:05 EST 2004


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.

Shane




More information about the Zope3-dev mailing list