def _callback(self, name, *args, **kwargs): if not name: name = get_last_func_name() if name.startswith('_on_'): name = name[4:] meth = getattr(self, 'on_%s' % name, None) if meth: meth(*args, **kwargs) #self.loop.add_callback(partial(meth, *args, **kwargs)) meth = getattr(self, 'on_%s_cb' % name, None) if meth: meth(self, *args, **kwargs)
def __call__(self, cmd, what, check, *args, **kwargs): if cmd is None: cmd = get_last_func_name() keys = self.keys() if cmd == 'load': keys.reverse() for k in keys: meth = getattr(k, cmd, None) if meth: ret = meth(what, *args, **kwargs) if not check: what = ret continue elif not ret: return ret if check: return True else: return what