def proxy(self, sync_type, name, args, kwargs): """ Call method on server. sync_type :: = 0 .. call method, wait, get response. = 1 .. call method, inmediate return of object. = 2 .. call notification and exit. = 3 .. call method, inmediate return of non-auto-close object. """ data = {} data["method"] = name if sync_type in [0, 1, 3]: data["id"] = self.get_id() if len(args) > 0: data["params"] = args if len(kwargs) > 0: if len(args) == 0: data["params"] = kwargs else: data["kwparams"] = kwargs if sync_type == 2: # short-circuit for speed! self.write(json.dumps(data, self)) return None req = Request(self, data) if sync_type == 0: return req.value if sync_type == 3: req.auto_close = False return req
def proxy(self, sync_type, name, args, kwargs): """ Call method on server. sync_type :: = 0 .. call method, wait, get response. = 1 .. call method, inmediate return of object. = 2 .. call notification and exit. = 3 .. call method, inmediate return of non-auto-close object. """ data = {} data['method'] = name if sync_type in [0, 1, 3]: data['id'] = self.get_id() if len(args) > 0: data['params'] = args if len(kwargs) > 0: if len(args) == 0: data['params'] = kwargs else: data['kwparams'] = kwargs if sync_type == 2: # short-circuit for speed! self.write(json.dumps(data, self)) return None req = Request(self, data) if sync_type == 0: return req.value if sync_type == 3: req.auto_close = False return req