[Zope3-dev] RFC: abolishing python: expressions in ZPT TALES

Terry Hancock hancock at anansispaceworks.com
Wed Dec 28 18:35:39 EST 2005


On Wed, 28 Dec 2005 12:26:13 -0330
Rocky Burt <rocky at serverzen.com> wrote:
> Its my personal opinion that anytime a page template
> requires logic complicated enough to warrant using a
> 'python:' expression, that logic should be re-thought and
> placed into a view class.  I know that some python:
> expressions are fairly simple, but for an HTML designer,
> *any* python: portions are dangerous to touch (and
> shouldn't be touched by the HTML designer).
> 
> What do you all think?

-10!

I think it's a terrible idea. Why do I have to learn a new
programming syntax just to get things done in ZPT? I do
*most* expressions in Python syntax, with very few
exceptions.

The python syntax is explicit, clear, and matches the syntax
used elsewhere in the program.

Besides, there are plenty of places where it is convenient
to use simple mathematical relationships to manage
presentation, such as:

<span tal:condition="python: i % 5 = 3">
</span>

for something that should occur in "every 5 repeats" of
something.

There's no way that sort of things should be considered
"business logic" -- it's just pagination or color bars or
some such thing.


-- 
Terry Hancock (hancock at AnansiSpaceworks.com)
Anansi Spaceworks http://www.AnansiSpaceworks.com



More information about the Zope3-dev mailing list