diff options
| author | Bas Peschier <basp@fabrique.nl> | 2015-03-07 13:18:04 +0100 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-03-09 20:30:01 -0400 |
| commit | 756cee46d25a52108fd7190f787a7e636962df5d (patch) | |
| tree | 534e871dfe139c384c1f043d3357360f3c3cd620 /django | |
| parent | 578ac17f814f21648484a1d846413398e92f8808 (diff) | |
Fixed #24455 -- Fixed crash in debug view with lazy objects
Diffstat (limited to 'django')
| -rw-r--r-- | django/views/debug.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/django/views/debug.py b/django/views/debug.py index 15da162493..d0235f4bd4 100644 --- a/django/views/debug.py +++ b/django/views/debug.py @@ -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): |
