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

Guido van Rossum guido@digicool.com
Fri, 06 Apr 2001 11:23:31 -0500


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:

  <p tal:condition="exists:request/foo">Text if foo is set</p>
  <p tal:else-condition="">Text if foo is not set</p>

You could have any number of else-condition statements following a
condition statement, just like Python's if...elif...elif...; the first
one whose expression evaluates to true is taken.  To spell plain else,
the last one can have an empty condition.

Problem with this: how do you know which condition a given
else-condition belongs to?  Should the elements be adjacent except for
whitespace?

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