[ZPT] Extending tal:condition, making metal:define
Guido van Rossum
guido@digicool.com
Fri, 06 Apr 2001 17:28:03 -0500
> The sort of thing I'm thinking of, call it "if:", would evaluate it's
> expression and catch any traversal errors (traversal would be modified
> to raise a new exception if a step failed in any way). On such an
> error, it would return (or raise) doNothing. TALInterpreter would be
> modified so that 'content', 'replace', and 'attributes' would do nothing
> if they receive this signal. That way we could write:
>
> <p tal:content="if:request/might_be_here">It isn't here.</p>
>
> If "path:request/might_be_here" resolves, then its value replaces the
> paragraph content, otherwise the default text remains. Likewise:
>
> <a href="/default.html" tal:attributes="href if:here/goto">Go here</a>
>
> "if::" could also be "optional:", or whatever.
OK, good. Now I understand. Should we do this for 1.1? (It's not
hard!)
--Guido van Rossum (home page: http://www.python.org/~guido/)