From 15bdc9788369c5fff63fde589fc9fcd0c41c23d3 Mon Sep 17 00:00:00 2001
From: Jon Dufresne <jon.dufresne@gmail.com>
Date: Sun, 4 May 2014 13:52:57 -0700
Subject: [PATCH] Send broken link emails for all 4XX.
This will allow manager to find links that incorrectly link to 403
responses or pages with other 4xx responses. This goal is to root out
these links and fix them.
---
django/middleware/common.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/django/middleware/common.py b/django/middleware/common.py
index c719f9e..112e564 100644
a
|
b
|
class BrokenLinkEmailsMiddleware(object):
|
129 | 129 | |
130 | 130 | def process_response(self, request, response): |
131 | 131 | """ |
132 | | Send broken link emails for relevant 404 NOT FOUND responses. |
| 132 | Send broken link emails for relevant 4XX responses. |
133 | 133 | """ |
134 | | if response.status_code == 404 and not settings.DEBUG: |
| 134 | if 400 <= response.status_code < 500 and not settings.DEBUG: |
135 | 135 | domain = request.get_host() |
136 | 136 | path = request.get_full_path() |
137 | 137 | referer = force_text(request.META.get('HTTP_REFERER', ''), errors='replace') |