diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2007-04-20 11:24:53 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2007-04-20 11:24:53 +0000 |
| commit | 9f180a1bc5e6e40c2b97b72ab15395f375861386 (patch) | |
| tree | fc0e9a0c29eed67fa5b70ec15b1fa8ca9a2786c3 | |
| parent | eb107e1ae95e180b07ac19915d2e50527d203d87 (diff) | |
Added client IP address to the e-mail that is sent when an internal
broken link is detected. This is to help with filtering out
misbehaving bots.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5043 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/middleware/common.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/middleware/common.py b/django/middleware/common.py index 6283214fad..9891b1efad 100644 --- a/django/middleware/common.py +++ b/django/middleware/common.py @@ -66,8 +66,10 @@ class CommonMiddleware(object): path = request.get_full_path() if referer and not _is_ignorable_404(path) and (is_internal or '?' not in referer): ua = request.META.get('HTTP_USER_AGENT', '<none>') + ip = request.META.get('REMOTE_ADDR', '<none>') mail_managers("Broken %slink on %s" % ((is_internal and 'INTERNAL ' or ''), domain), - "Referrer: %s\nRequested URL: %s\nUser agent: %s\n" % (referer, request.get_full_path(), ua)) + "Referrer: %s\nRequested URL: %s\nUser agent: %s\nIP address: %s\n" \ + % (referer, request.get_full_path(), ua, ip)) return response # Use ETags, if requested. |
