I've integrated Jinja2 in TurboGears 2.3.12 and in my template file, I have used the following code
<input type='text' value='{{ obj.attr }}' />
I got None in the textbox as the object was new. I want to remove the None to an empty string. Found the following solutions 1.
<input type='text' value='{{ obj.attr or '' }}' />
and 2. https://stackoverflow.com/a/17661969/2102143
I want to integrate the 2nd solution in TurboGears as it will be available to the entire app and also can avoid the or ''
I've overridden the classmethod "create" of tg.renderers.jinja.JinjaRenderer
config/Jinja.py
Then in config/app_cfg.py
Modified code