[ZPT] Re: macros and contexts

Dieter Maurer dieter at handshake.de
Tue Sep 16 13:35:52 EDT 2003


Chris Withers wrote at 2003-9-16 08:13 +0100:
 > ...
 > >  > >  <div tal:define="here nocall:here/foo">
 > >  > >   <div metal:use-macro="here/widgetlib/macros/widget_1_view">
 > >  > >     Widget 1 view goes here
 > >  > >   </div>
 > >  > >  </div>
 > >  > > 
 > >  > > Which is pretty nasty, but really seems to be the only solution...?
 > >  > 
 > >  > Why is it nasty? It is, after all, exactly what you're looking to do ;-)
 > > 
 > > It breaks abstraction...
 > > 
 > > In the widget library you do not know (and you should not know)
 > > what "here" is and you should not make assumptions about it.
 > 
 > Add the code Seb is using does exactly that from what I can see. The only 
 > assumption being made is that "here" is the current object that this piece of 
 > ZPT needs do deal with.
 > 
 > What leads you to feel differently?

The assumption is, that "widgetlib" can be acquired from "here".
Such an assumption should not be necessary (inside the widget library).


Dieter



More information about the ZPT mailing list