1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #24455 -- Fixed crash in debug view with lazy objects

This commit is contained in:
Bas Peschier
2015-03-07 13:18:04 +01:00
committed by Tim Graham
parent 578ac17f81
commit 756cee46d2
2 changed files with 40 additions and 1 deletions

View File

@@ -186,7 +186,15 @@ class SafeExceptionReporterFilter(ExceptionReporterFilter):
return request.POST
def cleanse_special_types(self, request, value):
if isinstance(value, HttpRequest):
try:
# If value is lazy or a complex object of another kind, this check
# might raise an exception. isinstance checks that lazy HttpRequests
# or MultiValueDicts will have a return value.
is_request = isinstance(value, HttpRequest)
except Exception as e:
return '{!r} while evaluating {!r}'.format(e, value)
if is_request:
# Cleanse the request's POST parameters.
value = self.get_request_repr(value)
elif isinstance(value, MultiValueDict):