Comment 1 for bug 394011

Revision history for this message
Malthe Borch (mborch) wrote : Re: [Bug 394011] [NEW] enable the use string: ${foo | nothing} to avoid a KeyError

2009/6/30 Edwin Grubbs <email address hidden>:
> Public bug reported:
>
> Currently, the following tal with raise a KeyError if $foo is undefined.
>  <span tal:content="string: Hello, ${foo}" />
>
> I would like to be able to indicate that I just want an empty string if the variable is undefined. The most consistent syntax would be:
>  <span tal:content="string: Hello, ${foo | nothing}">

This would yield:

<span>Hello, </span>

Can't you do:

<span tal:content="string: Hello, ${foo} | string:">

\malthe