errorpages.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:zing 作者: evernote 项目源码 文件源码
def log_exception(request, exception, tb):
    if sentry_exception_handler is None:
        # Send email to admins with details about exception
        ip_type = (request.META.get('REMOTE_ADDR') in
                   settings.INTERNAL_IPS and 'internal' or
                   'EXTERNAL')
        msg_args = {
            'ip_type': ip_type,
            'path': request.path,
        }
        subject = 'Error (%(ip_type)s IP): %(path)s' % msg_args

        try:
            request_repr = repr(request)
        except:
            request_repr = "Request repr() unavailable"

        msg_args = (unicode(exception.args[0]), tb,
                    request_repr)
        message = "%s\n\n%s\n\n%s" % msg_args
        mail_admins(subject, message, fail_silently=True)
    else:
        sentry_exception_handler(request=request)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号