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

Stefan H. Holek stefan at epy.co.at
Fri Feb 17 06:16:58 EST 2006

My take is that it's not the TAL features (tal:define, python:,  
whatever) that invite misuse, but the available namespaces.

I have ported ZPT to Django [1][2] and found the experience  
surprisingly refreshing. Django naturally does not have anything like  
"container" or "context" in the Zope sense. And by Django policy,  
templates don't even get to see the "request". The namespace Zope PTs  
call "options" becomes the sole, top-level namespace in Django PTs.

This very effectively keeps me from pulling-in anything not provided  
by the view in the first place. Everything -- even functions I want  
to call in, say, conditions -- has to be added by the view. The  
result is clean and fast templates.


[1] http://www.djangoproject.com
[2] http://zope.org/Members/shh/DjangoPageTemplates/1.0.2/readme.txt

On 11. Feb 2006, at 21:03, Jean-Marc Orliaguet wrote:

> I almost felt that something was missing, because I'm so used to  
> inserting "tal:define" in page templates. But now I realize that  
> this is a mistake.
> There was a discussion recently on the list about python  
> expressions being a bad idea, think twice I would say that  
> "tal:define" is much worse:
> When writing templates, the temptation is great to insert a  
> "tal:define" to pull some data into the view which is not directly  
> available in the model represented by the view. But the idea with a  
> template is that it should represent some data using some markup.  
> The data is supposed to be already available in some context. If  
> the presentation layer needs to cook some extra data, it means  
> that  there isn't enough presentation data in the first place.

Anything that happens, happens.  --Douglas Adams

More information about the Zope3-dev mailing list