def __init__(self, db=RUtils.RDateBasePool().begin(), token=None): self.config = RUtils.RConfig() self.info = UserInfo() self.db = db self.session = RUtils.RMemorySessionStore() if token: self.info.token = token self.login_by_token()
def reload(self): result = RUtils.RDateBasePool().execute( 'select * from users where uuid = %s;', (self.uuid,) ) if not result: raise RUtils.RError(0) result = result[0] self.admin = result['admin'] self.status = result['status'] self.username = result['username'] self.email = result['email']
def process_request(self, req, resp): req.context['sql'] = RUtils.RDateBasePool().begin()