[Zope3-dev] Re: tal:define="..." considered harmful?

Jean-Marc Orliaguet jmo at ita.chalmers.se
Sun Feb 12 13:57:52 EST 2006


Andreas Jung wrote:

>
>
> --On 12. Februar 2006 19:18:51 +0100 Max M <maxm at mxm.dk> wrote:
>
>>
>> <a href="#"
>>     tal:attributes="href here/absolute_url;
>>                     title here/title;
>>                     id here/getId"
>>     tal:content="here/Title">Title</a>
>>
>>
>> I could write this:
>>
>> <a href="here/absolute_url" id="here/getId" title="here/Title"
>>     tal:attributes="href; id; title"
>>     tal:content="here/Title">Title</a>
>>
>
> That's really syntactical sugar. The purpose of the tal: names is clearly
> to tell the parser to do _something_ with the value of an attribute. Now
> should a parser guess if the value of an attribute is something to be 
> processed or not? -1 for such ideas.
>
> -aj


That's more or less what i18n:attributes="attr1 attr2 ..." does already.

We continued the discussioned off-list earlier, and one idea that came 
up was:

what do we need to carry along the "context", "here", "request", "view" 
variables ... instead of having a single namespace, i.e. if I pass 
{'title': 'some title'} to the template, it is tempting to be able to write:

   <div tal:content="title">title comes here</div>

instead of:
 
   <div tal:content="here/title">title comes here</div>

one of the reasons for adding the 'here' namespace is that 'title' could 
as well be a local variable. But if "tal:define" is not implemented that 
is not an issue anymore since there are no local variables. That's what 
other template languages do by the way,  I guess that CTAL will simplify 
things too by exposing a single data structure to the user where 
everything is merged already.

/JM


More information about the Zope3-dev mailing list