Skip to content

Commit a78cb8c

Browse files
committed
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
1 parent fd9ee73 commit a78cb8c

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

ietf/settings.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,22 @@ def skip_suspicious_operations(record):
122122
'callback': skip_suspicious_operations,
123123
}
124124
LOGGING['handlers']['mail_admins']['filters'] += [ 'skip_suspicious_operations' ]
125+
# Filter out UreadablePostError:
126+
from django.http import UnreadablePostError
127+
def skip_unreadable_post(record):
128+
if record.exc_info:
129+
exc_type, exc_value = record.exc_info[:2]
130+
if isinstance(exc_value, UnreadablePostError):
131+
return False
132+
return True
133+
LOGGING['filters']['skip_unreadable_posts'] = {
134+
'()': 'django.utils.log.CallbackFilter',
135+
'callback': skip_unreadable_post,
136+
}
137+
LOGGING['handlers']['mail_admins']['filters'] += [ 'skip_unreadable_posts' ]
138+
139+
140+
125141

126142
# End logging
127143
# ------------------------------------------------------------------------

0 commit comments

Comments
 (0)