Ticket #10863: 10863.diff
File 10863.diff, 2.5 KB (added by , 16 years ago) |
---|
-
Users/boxed/django/django/core/handlers/base.py
154 154 return debug.technical_500_response(request, *exc_info) 155 155 156 156 # When DEBUG is False, send an error message to the admins. 157 from django.views.debug import ExceptionReporter 158 reporter = ExceptionReporter(request, *exc_info) 159 html = reporter.get_traceback_html() 160 157 161 subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS and 'internal' or 'EXTERNAL'), request.path) 158 162 try: 159 163 request_repr = repr(request) 160 164 except: 161 165 request_repr = "Request repr() unavailable" 162 166 message = "%s\n\n%s" % (self._get_traceback(exc_info), request_repr) 163 mail_admins(subject, message, fail_silently=True )167 mail_admins(subject, message, fail_silently=True, html_message=html) 164 168 # Return an HttpResponse that displays a friendly error message. 165 169 callback, param_dict = resolver.resolve500() 166 170 return callback(request, **param_dict) -
Users/boxed/django/django/core/mail.py
368 368 for subject, message, sender, recipient in datatuple] 369 369 return connection.send_messages(messages) 370 370 371 def mail_admins(subject, message, fail_silently=False ):371 def mail_admins(subject, message, fail_silently=False, html_message=None): 372 372 """Sends a message to the admins, as defined by the ADMINS setting.""" 373 373 if not settings.ADMINS: 374 374 return 375 EmailMessage(settings.EMAIL_SUBJECT_PREFIX + subject, message, 376 settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS] 377 ).send(fail_silently=fail_silently) 375 from django.core.mail import EmailMultiAlternatives 376 msg = EmailMultiAlternatives(settings.EMAIL_SUBJECT_PREFIX + subject, message, settings.SERVER_EMAIL, [a[1] for a in settings.ADMINS]) 377 if html_message: 378 msg.attach_alternative(html_message, "text/html") 379 msg.send(fail_silently=fail_silently) 378 380 379 381 def mail_managers(subject, message, fail_silently=False): 380 382 """Sends a message to the managers, as defined by the MANAGERS setting."""