detect bool, int, float in order

master
inpos 2018-08-09 20:41:21 +03:00
parent b59a27d561
commit 6727d36b1a
1 changed files with 6 additions and 2 deletions

View File

@ -30,13 +30,17 @@ def encode(o):
return str(o) return str(o)
elif isinstance(o, (list, tuple)): elif isinstance(o, (list, tuple)):
return list2extjs(o) return list2extjs(o)
elif isinstance(o, bool):
return str(o).lower()
elif isinstance(o, int): elif isinstance(o, int):
return '%d' % o return str(o)
elif isinstance(o, float):
return str(o)
elif isinstance(o, str): elif isinstance(o, str):
return '\'%s\'' % o return '\'%s\'' % o
elif isinstance(o, types.FunctionType): elif isinstance(o, types.FunctionType):
return str(function(js_ajax(o))) return str(function(js_ajax(o)))
elif isinstance(o, type(stub_class.stub_method)): elif isinstance(o, types.MethodType):
return str(function(js_ajax(o))) return str(function(js_ajax(o)))
elif isinstance(o, FuncWithParams): elif isinstance(o, FuncWithParams):
return str(function(js_ajax(o.func, o.params))) return str(function(js_ajax(o.func, o.params)))