[Zope3-dev] Re: Namespaces considered harmful [Was:
tal:define="..." considered harmful?]
Tonico Strasser
contact_tonico at yahoo.de
Fri Feb 17 10:25:24 EST 2006
Stefan H. Holek wrote:
> 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.
This sounds like best practice to me.
> [2] http://zope.org/Members/shh/DjangoPageTemplates/1.0.2/readme.txt
I would even go a step further and leave the macro mapping to the view
and write
<html metal:use-macro="macros/master"/>
instead of
<html metal:use-macro="templates/myapp/main/macros/master"/>
. Thus making the template more generic.
Tonico
More information about the Zope3-dev
mailing list