Source code for intranet.views.exceptionviews

import morepath

from import Public
from onegov.intranet import IntranetApp
from import handle_forbidden
from onegov.user import Auth
from purl import URL
from webob.exc import HTTPForbidden

from typing import TYPE_CHECKING
    from onegov.core.types import RenderData
    from import OrgRequest
    from webob import Response

[docs] def handle_forbidden_for_homepage( self: HTTPForbidden, request: 'OrgRequest' ) -> 'RenderData | Response': """ Usually, the forbidden view offers no way to log in, as we usually do not need that feature (exception views should be simple). For the intranet though, we make an exception for requests hitting the front-page directly. This is not strictly correct as far as HTTP is concerned. """ login_url =, name='login') if URL(request.url).path() == '/': return morepath.redirect(login_url) return handle_forbidden(self, request)