From 7ab5ce6cf1f2ea01857f828836d1bc6a21c1109f Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 17 Mar 2011 10:33:08 +0000 Subject: [PATCH] Fixed #15628 -- Made the admin error email more useful when there isn't a request associated with the message. Thanks to hynek for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15869 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/log.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/django/utils/log.py b/django/utils/log.py index 763e667c57..4fb75b1504 100644 --- a/django/utils/log.py +++ b/django/utils/log.py @@ -79,7 +79,11 @@ class AdminEmailHandler(logging.Handler): ) request_repr = repr(request) except: - subject = 'Error: Unknown URL' + subject = '%s: %s' % ( + record.levelname, + record.msg + ) + request = None request_repr = "Request repr() unavailable"