summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJannis Leidel <jannis@leidel.info>2012-11-22 10:03:52 +0100
committerJannis Leidel <jannis@leidel.info>2012-11-22 10:05:08 +0100
commit3fb83729b9fd7d5e46263286d42f47cb52ac2824 (patch)
treec709637bc8df0b617f35d641f2387788ef6988a8 /django
parentd80d05fc673665fa614e65eb2c38b654ccf28235 (diff)
parentf9891f20872e2a468c4910a968c5e2fae75d0e51 (diff)
Merge branch 'ticket_19325' of https://github.com/hannesstruss/django into hannesstruss-ticket_19325
Diffstat (limited to 'django')
-rw-r--r--django/utils/log.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/django/utils/log.py b/django/utils/log.py
index 4806527e84..736154a178 100644
--- a/django/utils/log.py
+++ b/django/utils/log.py
@@ -3,6 +3,7 @@ import traceback
from django.conf import settings
from django.core import mail
+from django.core.mail import get_connection
from django.views.debug import ExceptionReporter, get_exception_reporter_filter
@@ -76,9 +77,10 @@ class AdminEmailHandler(logging.Handler):
request data will be provided in the email report.
"""
- def __init__(self, include_html=False):
+ def __init__(self, include_html=False, email_backend=None):
logging.Handler.__init__(self)
self.include_html = include_html
+ self.email_backend = email_backend
def emit(self, record):
try:
@@ -110,7 +112,12 @@ class AdminEmailHandler(logging.Handler):
message = "%s\n\n%s" % (stack_trace, request_repr)
reporter = ExceptionReporter(request, is_email=True, *exc_info)
html_message = self.include_html and reporter.get_traceback_html() or None
- mail.mail_admins(subject, message, fail_silently=True, html_message=html_message)
+ mail.mail_admins(subject, message, fail_silently=True,
+ html_message=html_message,
+ connection=self.connection())
+
+ def connection(self):
+ return get_connection(backend=self.email_backend)
def format_subject(self, subject):
"""