serialize class method

master
inpos 2018-08-09 14:45:14 +03:00
parent a82d35eed8
commit 113959b7d7
1 changed files with 7 additions and 0 deletions

View File

@ -8,6 +8,11 @@ js_ajax = None
live_methods = {}
class STUB:
def stub_method(self):
pass
stub_class = STUB()
class FuncWithParams:
def __init__(self, func, params):
self.func = func
@ -31,6 +36,8 @@ def encode(o):
return '\'%s\'' % o
elif isinstance(o, types.FunctionType):
return str(function(js_ajax(o)))
elif isinstance(o, type(stub_class.stub_method)):
return str(function(js_ajax(o)))
elif isinstance(o, FuncWithParams):
return str(function(js_ajax(o.func, o.params)))
elif isinstance(o, JsFunction):