From a78cb8ce36a52d3564163bf928a397b8dbf213c0 Mon Sep 17 00:00:00 2001 From: Henrik Levkowetz Date: Sat, 26 Jul 2014 11:31:16 +0000 Subject: [PATCH] Added a filter to stop reporting failed uploads to the admin email address -- these seem to occur regularly when a client looses (WiFi) connectivity, and this is not something we can do anything about. - Legacy-Id: 8212 --- ietf/settings.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ietf/settings.py b/ietf/settings.py index 1b9aa8da0..bf7ffe704 100644 --- a/ietf/settings.py +++ b/ietf/settings.py @@ -122,6 +122,22 @@ LOGGING['filters']['skip_suspicious_operations'] = { 'callback': skip_suspicious_operations, } LOGGING['handlers']['mail_admins']['filters'] += [ 'skip_suspicious_operations' ] +# Filter out UreadablePostError: +from django.http import UnreadablePostError +def skip_unreadable_post(record): + if record.exc_info: + exc_type, exc_value = record.exc_info[:2] + if isinstance(exc_value, UnreadablePostError): + return False + return True +LOGGING['filters']['skip_unreadable_posts'] = { + '()': 'django.utils.log.CallbackFilter', + 'callback': skip_unreadable_post, +} +LOGGING['handlers']['mail_admins']['filters'] += [ 'skip_unreadable_posts' ] + + + # End logging # ------------------------------------------------------------------------