class DBClt(object): def __init__(self): self.afunc = None def connect(self, dbsvr): self.dbsvr = dbsvr self.db_result = None self.afunc = AFunc(self.dbsvr.start) self.afunc.start() return self def _call_(self, func_name, *args, **keywords): msg = pickle.dumps({'name': func_name, 'args': args, 'keywords': keywords}) for y in self.afunc.call(msg): yield y self.db_result = pickle.loads(self.afunc.func_ret) def __getattr__(self, name): return functools.partial(self._call_, name)
def connect(self, dbsvr): self.dbsvr = dbsvr self.db_result = None self.afunc = AFunc(self.dbsvr.start) self.afunc.start() return self