[Cheetahtemplate-discuss] Filter isn't played for None value
Brought to you by:
rtyler,
tavis_rudd
From: Thibaud R. <thi...@gm...> - 2011-11-09 12:59:09
|
Hello, I have to apply filter to placeholders which can have None value. However, the filter isn't apply. For example : import Cheetah.Template from Cheetah.Filters import Filter class MyFilter(Filter): def filter(self, val, **kw): return "tit" if __name__ == '__main__': print "test01" searchList=[{'myvar1': u'test'}, {'myvar2': None}] t = Cheetah.Template.Template(''' 1. -${getVar('myvar1', '456')}- 2. -${getVar('myvar2', ''), maxlen=2}- 3. -${getVar('myvar3', None), maxlen=2}- ''', searchList, filter=MyFilter ) print t The output is as follow : 1. -tit- 2. -- 3. -- Is there any way to apply filter to None value ? Thanks a lot. Thibaud |