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

Igor Stroh igor at rulim.de
Wed Dec 28 17:00:28 EST 2005


Rocky Burt wrote:
> Hi all,
> 
> Please don't mistake this as a proposal or anything of the sort but I
> was just curious what the rest of the zope3 community thought on this
> particular topic.  (Please forgive me if this topic has been exhaused to
> death already)
> 
> 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?

+/-0
I'd give it a +1 if TAL would support boolean operators :)
Seriously, there are situations where all you need is a trivial
AND or an OR expression, writing a view method to simply
be able to "select" a value (like in [0]) is just too much
overhead... Another use case is the passing of arguments
to a method/function/whatever - you might have a tal:repeat
where each iteration calls a view method and where just need
to supply an argument and you can't since TALs path syntax
doesn't support that (I say tal:repeat here, 'cos in other
situations you _probably_ can retrieve the value from REQUEST).

[0]: e.g. tal:define="foo python: bar and 'yes' or 'no'"

Cheers,
Igor


More information about the Zope3-dev mailing list