Ticket #7472: 7472-2.patch
File 7472-2.patch, 3.5 KB (added by , 16 years ago) |
---|
-
django/core/handlers/base.py
124 124 else: 125 125 # When DEBUG is False, send an error message to the admins. 126 126 subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS and 'internal' or 'EXTERNAL'), request.path) 127 try: 128 request_repr = repr(request) 129 except: 130 request_repr = "Request repr() unavailable" 127 if request.is_secure(): 128 request_repr = "Request details omitted because HTTPS was used." 129 else: 130 try: 131 request_repr = repr(request) 132 except: 133 request_repr = "Request repr() unavailable" 131 134 message = "%s\n\n%s" % (self._get_traceback(exc_info), request_repr) 132 135 mail_admins(subject, message, fail_silently=True) 133 136 # Return an HttpResponse that displays a friendly error message. -
django/middleware/common.py
96 96 is_internal = _is_internal_request(domain, referer) 97 97 path = request.get_full_path() 98 98 if referer and not _is_ignorable_404(path) and (is_internal or '?' not in referer): 99 ua = request.META.get('HTTP_USER_AGENT', '<none>') 100 ip = request.META.get('REMOTE_ADDR', '<none>') 99 if request.is_secure(): 100 message = "Request details omitted because HTTPS was used." 101 else: 102 ua = request.META.get('HTTP_USER_AGENT', '<none>') 103 ip = request.META.get('REMOTE_ADDR', '<none>') 104 message = "Referrer: %s\nRequested URL: %s\nUser agent: %s\nIP address: %s\n" \ 105 % (referer, request.get_full_path(), ua, ip) 101 106 mail_managers("Broken %slink on %s" % ((is_internal and 'INTERNAL ' or ''), domain), 102 "Referrer: %s\nRequested URL: %s\nUser agent: %s\nIP address: %s\n" \ 103 % (referer, request.get_full_path(), ua, ip)) 107 message) 104 108 return response 105 109 106 110 # Use ETags, if requested. -
docs/settings.txt
1239 1239 1240 1240 To disable this behavior, just remove all entries from the ``ADMINS`` setting. 1241 1241 1242 The notification email contains information about the request which triggered 1243 the error, including GET data, POST data, cookies and other headers. If the 1244 request was made over HTTPS, this information is omitted for security reasons. 1245 1242 1246 404 errors 1243 1247 ---------- 1244 1248 … … 1259 1263 be reported. Neither will any URL starting with ``/phpmyadmin/``. 1260 1264 1261 1265 To disable this behavior, just remove all entries from the ``MANAGERS`` setting. 1266 1267 The notification email contains information about the request which triggered 1268 the 404, including the referer, user agent and client IP. If the request was 1269 made over HTTPS, this information is omitted for security reasons.