##// END OF EJS Templates
templatefilter: add support for 'long' to json()...
Matt Harbison -
r31728:35eb8f11 default
parent child Browse files
Show More
@@ -221,7 +221,7 b' def indent(text, prefix):'
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 or obj is False or obj is True:
223 return {None: 'null', False: 'false', True: 'true'}[obj]
223 return {None: 'null', False: 'false', True: 'true'}[obj]
224 elif isinstance(obj, int) or isinstance(obj, float):
224 elif isinstance(obj, (int, long, float)):
225 return str(obj)
225 return str(obj)
226 elif isinstance(obj, str):
226 elif isinstance(obj, str):
227 return '"%s"' % encoding.jsonescape(obj, paranoid=True)
227 return '"%s"' % encoding.jsonescape(obj, paranoid=True)
General Comments 0
You need to be logged in to leave comments. Login now