[ZPT] Extending tal:condition, making metal:define

Guido van Rossum guido@digicool.com
Fri, 06 Apr 2001 12:55:48 -0500


> From: "Guido van Rossum" <guido@digicool.com>
> > The general problem in this thread seems to be that TAL (like DTML?)
> > doesn't have an "else" construct.  Could we add one, e.g. as follows:
> 
> The reason for that (beyond the awkwardness of trying to spell alternate
> branches in attribute language) is that anything more complex than
> on/off or replace/don't behavior violates the WYSIWYG principle of ZPT.
> In other words, when you are viewing template source, it is easy to
> visualize the effect of omitting an element, and trivially easy to see
> the effect of leaving an element unchanged.  On the other hand, placing
> multiple versions of an element side-by-side is likely to distort the
> page.
> 
> This is the problem that we intended to address with "modes", and may be
> able to implement with switchable macro references.

Maybe, but your initial post here *wanted* an else, and you solved it
with two conditions, the second being the reverse of the first.  That
also violates the WYSIWYG principle.

Given that this is probably a common request, what are we going to
*do* about it?  All solutions are hacks!  (My own solution uses
on-error :-).

--Guido van Rossum (home page: http://www.python.org/~guido/)