##// END OF EJS Templates
templatefilters: unroll handling of None/False/True...
Yuya Nishihara -
r31780:8d9eafe0 default
parent child Browse files
Show More
@@ -219,8 +219,12 b' def indent(text, prefix):'
219
219
220 @templatefilter('json')
220 @templatefilter('json')
221 def json(obj):
221 def json(obj):
222 if obj is None or obj is False or obj is True:
222 if obj is None:
223 return {None: 'null', False: 'false', True: 'true'}[obj]
223 return 'null'
224 elif obj is False:
225 return 'false'
226 elif obj is True:
227 return 'true'
224 elif isinstance(obj, (int, long, float)):
228 elif isinstance(obj, (int, long, float)):
225 return str(obj)
229 return str(obj)
226 elif isinstance(obj, str):
230 elif isinstance(obj, str):
General Comments 0
You need to be logged in to leave comments. Login now