Python vs PHP
ialbert at mailblocks.com
Fri Oct 22 21:31:42 CEST 2004
Alex Martelli wrote:
> Me too. nevow forever...!!!
Hm, it says on their page:
"However, no actual code may be embedded in the HTML template"
alas these are the sort of design decisions that
won't adapt well for real life scenarios.
Should we use code in templates? No. Should we make
every possible effort to prepare the data exactly as
we need. Absolutely.
Yet as soon as the whole thing is working we realize
that we forgot something and that fixing it the
"right way" will cause a significant setback. That's
reality, trying to avoid these by mandating a
certain behavior will only make the framework less
And that is where ZPT shines. You want full separation
go ahead. You want to bend the rules a bit go ahead.
You want to do it the wrong way and put your entire
program into the first "define" tag, well, guess
what you can do that too.
Where ZPT sucks is in its messy way to deal with
expressions. There are whole bunch of ways to create
* path expressions - locate a value by its path.
* exists expressions - test whether a path is valid.
* nocall expressions - locate an object by its path.
* not expressions - negate an expression
* string expressions - format a string
* python expressions - execute a Python expression
and when one starts combining these all kinds of
peculiarities will have to be dealt with.
ps. as I look that the data/render example, I noticed
the color attribute is actually created in the
code ... IMO this is exactly what we are trying to avoid
with templating. There is no indication in the
template that a new attribute is going to be added
to the tag ...
compare this to the same thing in ZPT:
<span tal:content="name" tal:attributes="style color">Tag Name</span>
More information about the Python-list