[Zope3-dev] Re: New METAL extension feature

Shane Hathaway shane at hathawaymix.org
Tue Nov 30 18:01:09 EST 2004


On Tue, November 30, 2004 11:48 am, Alec Munro said:
> So if I have this correct.
> Previously, if you wanted to extend a macro, you would use a facade
> (I'm not sure if that is the official language), and in that case, you
> had to both fill and define all the slots in your facade that were
> defined in your original macro.
> Currently, the situation is similar, but you only fill and define the
> slots that you wish to change. The other slots are passed through to
> templates that call the macro.

Exactly.

> This seems like a very positive change in terms of reducing busy work
> for template developers. Any chance will see this backported to 2.8?
> It could certainly be useful.

There's a fair chance you can simply change the import statements in the
PageTemplates product to import zope.tal.* instead of TAL.*.  I suspect
the official integration will appear in Zope 2.9, though.

> I do wonder about one thing though. In my facades, I would often have
> a section like the following:
>
> <span metal:fill-slot="style">
>  <link rel="stylesheet" href="somestyle.css" />
>  <span metal:define-slot="style"></span>
> </span>
>
> What happens in this circumstance? What happens if I define a new slot
> within a fill slot?

Interesting--you're trying to decorate a slot by giving the same name to
both an outer and an inner slot.  It doesn't work; templates that use your
macro will override the outer slot rather than the inner slot.  I wonder
if that should change.

If you give the inner slot a different name, OTOH, you can override the
inner slot.

> Thanks for this change, I'm betting it will become a very useful pattern.

Thanks.

Shane




More information about the Zope3-dev mailing list