Skip to content

Middleware

hypha.apply.middleware

HandleProtectionErrorMiddleware

HandleProtectionErrorMiddleware(get_response)
Source code in hypha/apply/middleware.py
def __init__(self, get_response):
    self.get_response = get_response

get_response instance-attribute

get_response = get_response

process_exception

process_exception(request, exception)
Source code in hypha/apply/middleware.py
def process_exception(self, request, exception):
    if isinstance(exception, ProtectedError):
        messages.error(
            request,
            _(
                "The object you are trying to delete is used somewhere. Please remove any usages and try again!."
            ),
        )
        return HttpResponseRedirect(request.path)

    return None