Ticket #14972: adminemailhandler.patch

File adminemailhandler.patch, 1.2 KB (added by jamstooks, 5 years ago)
  • django/utils/log.py

     
    8080            request_repr = "Request repr() unavailable"
    8181
    8282        if record.exc_info:
    83             exc_info = record.exc_info
    84             stack_trace = '\n'.join(traceback.format_exception(*record.exc_info))
     83            message = '\nSTACK_TRACE:\n'.join(traceback.format_exception(*record.exc_info))
     84            reporter = ExceptionReporter(request, is_email=True, *record.exc_info)
     85            html_message = reporter.get_traceback_html()
    8586        else:
    86             exc_info = ()
    87             stack_trace = 'No stack trace available'
    88 
    89         message = "%s\n\n%s" % (stack_trace, request_repr)
    90         reporter = ExceptionReporter(request, is_email=True, *exc_info)
    91         html_message = reporter.get_traceback_html()
     87            message = '\n%s\n\nNo stack trace available' % record.msg
     88            html_message = None
     89           
     90        message = "%s\n\n%s" % (message, request_repr)
    9291        mail.mail_admins(subject, message, fail_silently=True,
    9392                         html_message=html_message)
Back to Top