On 14 May 2012 07:30, Максим Коринец <[email protected]> wrote:
> To add to other answers - while using Mako I sometimes implement default
> rendering like this:
>
> <div>${variable or 'some default value'}</div>
>
> So, if variable is None, some default value is rendered. Don't know if this
> will work with Chameleon though.
Yep, it will.
Alternatively, you can use the ternary operator if you strictly want
to guard against ``None``:
${variable if variable is not None else 'some default value'}
\malthe
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.