from quixote import get_session, get_request, redirect

from qommon.errors import *

class AccessUnauthorizedError(AccessError):
    def render [html] (self):
        session = get_session()
        request = get_request()
        session.after_url = str('%s?%s' % (request.get_url(), request.get_query()))
        # TODO : SAML2
        login_url = '%s/liberty/larpe/login' % request.environ['SCRIPT_NAME']
        redirect(login_url)
