Hi,
On 2010-09-19 2:21 AM, kevin wrote:
if a variable is None, the text 'None' gets output/printed in the html.
is possible to have empty string instead of 'None'?
thanks
Yes, you can override the finalize method or patch it on the environment:
def silent_none(value):
if value is None:
return ''
return value
from jinja2 import Environment
env = Environment()
env.finalize = silent_none
I however recommend being explicit instead of a finalizer:
{{ variable or '' }}
Regards,
Armin
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" 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/pocoo-libs?hl=en.