Source code for oioioi.base.utils.middleware

[docs]EXCEPTION_GENERATED_STATUS_CODES = [400, 403, 404, 500]
# Django converts exceptions from middlewares to HttpResponses with above # status codes. Overridable method of middleware factory process_exception() # processes only exceptions generated by the view itself, but sometimes we want # to proceed with a certain action when some other middleware throws.
[docs]def was_response_generated_by_exception(response): return response.status_code in EXCEPTION_GENERATED_STATUS_CODES