Revert changes to two django files which should not have been part of [6724].

- Legacy-Id: 6725
Note: SVN reference [6724] has been migrated to Git commit 8f67ca6826
This commit is contained in:
Henrik Levkowetz 2013-11-21 16:40:28 +00:00
parent 8f67ca6826
commit d2d1c839c9
2 changed files with 4 additions and 17 deletions

View file

@ -176,8 +176,7 @@ class BaseHandler(object):
request_repr = "Request repr() unavailable"
message = "%s\n\n%s" % (self._get_traceback(exc_info), request_repr)
extra_emails = self._get_extra_emails(exc_info)
admin_emails = self._get_admin_emails(exc_info)
mail_admins(subject, message, fail_silently=True, html_message=html, extra_emails=extra_emails, admin_emails=admin_emails)
mail_admins(subject, message, fail_silently=True, html_message=html, extra_emails=extra_emails)
# If Http500 handler is not installed, re-raise last exception
if resolver.urlconf_module is None:
raise exc_info[1], None, exc_info[2]
@ -201,18 +200,6 @@ class BaseHandler(object):
tb = tb.tb_next
return admins
def _get_admin_emails(self, exc_info=None):
"""Helper function to retrieve app-specific admin email overrides.
Here we stop as soon as we've found a setting, since the purpose
here is to be able to limit the distribution of email notifications
for especially sensitive modules."""
etype, value, tb = exc_info or sys.exc_info()
while tb is not None:
f = tb.tb_frame
if "ADMIN_EMAILS" in f.f_globals:
return f.f_globals["ADMIN_EMAILS"]
return None
def apply_response_fixes(self, request, response):
"""
Applies each of the functions in self.response_fixes to the request and

View file

@ -83,11 +83,11 @@ def send_mass_mail(datatuple, fail_silently=False, auth_user=None,
return connection.send_messages(messages)
def mail_admins(subject, message, fail_silently=False, connection=None, html_message=None, extra_emails=[], admin_emails=None):
def mail_admins(subject, message, fail_silently=False, connection=None, html_message=None, extra_emails=[]):
"""Sends a message to the admins, as defined by the ADMINS setting."""
if not (settings.ADMINS or extra_emails or admin_emails):
if not (settings.ADMINS or extra_emails):
return
emails = admin_emails if admin_emails else set(list(settings.ADMINS) + extra_emails)
emails = set(list(settings.ADMINS) + extra_emails)
from django.core.mail import EmailMultiAlternatives
msg = EmailMultiAlternatives(settings.EMAIL_SUBJECT_PREFIX + subject, message, settings.SERVER_EMAIL, [a[1] for a in emails])
if html_message: