From 6727d36b1aa40670a2a6936b9bc224b66ea04f9b Mon Sep 17 00:00:00 2001 From: inpos Date: Thu, 9 Aug 2018 20:41:21 +0300 Subject: [PATCH] detect bool, int, float in order --- orun/js.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/orun/js.py b/orun/js.py index b08bf22..7eb16c4 100644 --- a/orun/js.py +++ b/orun/js.py @@ -30,13 +30,17 @@ def encode(o): return str(o) elif isinstance(o, (list, tuple)): return list2extjs(o) + elif isinstance(o, bool): + return str(o).lower() elif isinstance(o, int): - return '%d' % o + return str(o) + elif isinstance(o, float): + return str(o) elif isinstance(o, str): return '\'%s\'' % o elif isinstance(o, types.FunctionType): 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))) elif isinstance(o, FuncWithParams): return str(function(js_ajax(o.func, o.params)))