Example #1
0
def get_auth_or_create_guest(request):
    auth_json = request.session.get(SESSION_AUTH, None)
    if auth_json is None:
        auth = Instance.get_auth('guest', '')
        if auth is not None:
            request.session[SESSION_AUTH] = serialize_auth(auth)
    else:
        auth = deserialize_auth(auth_json)
    return auth
Example #2
0
def end_request(request, auth):
    request.session[SESSION_AUTH] = serialize_auth(auth)