Ejemplo n.º 1
0
def current_user(request):
    if 'session_id' in request.cookies:
        session_id = request.cookies['session_id']
        u = Session.find_user(session_id=session_id)
        return u
    else:
        return User.guest()
Ejemplo n.º 2
0
def current_user(request) -> User:
    if 'session_id' in request.cookies:
        session_id = request.cookies['session_id']
        user = Session.find_user(session_id)
        if user is not None:
            return user
        else:
            return User.guest()
    else:
        return User.guest()