From de35a3ab14ca2fb88b4524c8ea0ebaa9e28eb85b Mon Sep 17 00:00:00 2001 From: Julien Phalip Date: Fri, 2 Sep 2011 03:04:02 +0000 Subject: Fixed #16736 -- Enabled the merging of user-supplied arguments to format the error emails' subject in `AdminEmailHandler`. git-svn-id: http://code.djangoproject.com/svn/django/trunk@16715 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/utils/log.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'django/utils') diff --git a/django/utils/log.py b/django/utils/log.py index 1c3fe70155..a8098fcd2a 100644 --- a/django/utils/log.py +++ b/django/utils/log.py @@ -31,15 +31,16 @@ if not logger.handlers: logger.addHandler(NullHandler()) class AdminEmailHandler(logging.Handler): - def __init__(self, include_html=False): - logging.Handler.__init__(self) - self.include_html = include_html - """An exception log handler that emails log entries to site admins. If the request is passed as the first argument to the log record, request data will be provided in the email report. """ + + def __init__(self, include_html=False): + logging.Handler.__init__(self) + self.include_html = include_html + def emit(self, record): try: request = record.request @@ -53,7 +54,7 @@ class AdminEmailHandler(logging.Handler): except: subject = '%s: %s' % ( record.levelname, - record.msg + record.getMessage() ) request = None request_repr = "Request repr() unavailable." @@ -62,7 +63,7 @@ class AdminEmailHandler(logging.Handler): exc_info = record.exc_info stack_trace = '\n'.join(traceback.format_exception(*record.exc_info)) else: - exc_info = (None, record.msg, None) + exc_info = (None, record.getMessage(), None) stack_trace = 'No stack trace available' message = "%s\n\n%s" % (stack_trace, request_repr) -- cgit v1.3