def find_user(cls, session_id): s = cls.one(session_id=session_id) if s is None or s.expired(): return User.guest() else: u = User.one(id=s.user_id) if u is None: return User.guest() else: return u
def user(self): u = User.one(id=self.user_id) return u