How do web templates separate content and logic?

bruno.desthuilliers at gmail.com bruno.desthuilliers at gmail.com
Mon Jun 30 13:49:57 EDT 2008


On 30 juin, 19:19, Mike <ter... at gmail.com> wrote:
> On Jun 30, 10:57 am, Bruno Desthuilliers <bruno.
>
> 42.desthuilli... at websiteburo.invalid> wrote:
>
> > Some (if not most) templating systems use their own mini-language to
> > handle presentation logic.
>
> IMHO this is the funniest (worst) part of all this 'templating'
> buss  :)
> It reminds me the good old slogan: "Have you invented your own GUI
> library yet?"

Yeps, there's something true here. FWIW, my favorite templating system
so for is still Mako, for it doesn't try to reinvent yet another
language - just uses Python as both the target runtime and the
scripting language.

(snip)

> > > Or could it just be that
> > > this is a *good* way to mix HTML and Python, and there are other ways
> > > which may be bad?
>
> > Bingo.
>
> Then what is so *good* about it, why embedding HTML into Python is not
> good?

Who said embedding HTML in Python was bad ? Did you _carefully_ read
John's question ?-)

wrt/ what's so good about it: web designers are usually better at
working with this approach (whatever scripting language embedded in
html) than they are writing Python code - either as plain strings or
using a more declarative syntax like the one provided by Stan or
equivalent html generators.  But nothing prevents you from using
Mako's internals directly if you find it easier and more
maintainable !-)




More information about the Python-list mailing list