def _do(self, handler, chan, args, kwargs): try: ret = handler(*args, **kwargs) if chan: chan = rebuild_connection(*chan) chan.send(ret) chan.close() except Exception, e: if chan: chan = rebuild_connection(*chan) chan.send(e) chan.close()
def _rebuild_connection(authkey, *args): current_process().authkey = AuthenticationString(authkey) return rebuild_connection(*args)