Sat, 11 Feb 2006 21:03:21 +0100 keltezéssel Jean-Marc Orliaguet azt
> I almost felt that something was missing, because I'm so used to inserting
> "tal:define" in page templates. But now I realize that this is a mistake.
> There was a discussion recently on the list about python expressions being
> a bad idea, think twice I would say that "tal:define" is much worse:

I would also be interested on what the general opinion about this; I also
agree that in case of AJAX if the server prepares all the data that needs
to be inserted to the page (which is a Good Thing to do) there is not much 
need to use defines. Also I use the same design pattern a lot when
implementing custom widgets on the server side; that is, I try to move all
the logic out of the template and into the view methods.

However I think that the bad idea is not tal:define itself but the use (or
abuse) of expressions. For me tal:define is mainly a way to give
expression results a name and (re)use them in the template elsewhere. So I
would not restrict the use of tal:define but rather discourage the use of
expressions themselves.

Personally I feel that some simple overviewable string expressions in
a define (or directly in a content or replace) don't do much harm but then
I would probably even try to avoid those if possible. For me it is mostly
a matter of finding the right balance between readability and performance;
I almost always prefer the first one and do a good design right away. But
as far as ctal is concerned, I would consider adding "ctal:define" to
the implementation.

Balazs Ree

Zope3-dev mailing list

Reply via email to