[Zope-dev] TALES wish : the "thistemplate" variable

Shane Hathaway shane@zope.com
Wed, 23 Jul 2003 13:21:14 -0400


Gilles Lenfant wrote:
> What's behind this ?
> 
> Actually, we get the "template" variable available in the TALES namespace.
> "template", when used in a macro, refers to the template that uses the
> macro, and not to the template that contains the macro.

IMHO the underlying problem is that there's no clean way to control the 
variables used in a macro.  Macros inherit whatever variables the 
template happens to be using.  You can usually predict what variables 
will be available, but you have no guarantees.  You might not even get 
"template" or "here".

We recently had a discussion about this:

http://dev.zope.org/Wikis/DevSite/Proposals/MacroParameters

The conclusion we came to is that we need a new kind of construct, 
tentatively called a "subtemplate".  Subtemplates accept parameters and 
have full control over the variable namespace, including the "template" 
variable.

Shane