src/cm/utils/log.py
author Simon Descarpentries <sid@sopinspace.com>
Wed, 30 Oct 2013 18:08:42 +0100
changeset 556 69503659fe8f
parent 201 e0032b64c314
permissions -rw-r--r--
[c_selection.js] If safari_mobile, get current selection from a previously created global variable [c_sync.js] ref where the safari_mobile global is used [c_text_view_comments.js] if safari_mobile update selection also on selectionChange event [text_view_comments.html] if safari_mobile store a clone of the current selection on each selectionChange set layout width to 99% to improve display factorize safari mobile detection code

from django.conf import settings
from django.core.mail import mail_admins
import sys

def _get_traceback(exc_info):
    import traceback
    return '\n'.join(traceback.format_exception(*(exc_info or sys.exc_info())))

def error_mail_admins(subject='Error', request=None):
    if request:        
        subject = 'Error (%s IP): %s' % ((request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS and 'internal' or 'EXTERNAL'), request.path)
        
    try:
        request_repr = repr(request)
    except:
        request_repr = "Request repr() unavailable"
        
    exc_info = sys.exc_info()
    message = "%s\n\n%s" % (_get_traceback(exc_info), request_repr)
    
    mail_admins(subject, message, fail_silently=True)