Refs #24733 -- Removed support for error views without the exception parameter.
Per deprecation timeline.
This commit is contained in:
parent
5d8da093a9
commit
3cee9edd1b
|
@ -2,7 +2,6 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -12,7 +11,6 @@ from django.http import Http404
|
||||||
from django.http.multipartparser import MultiPartParserError
|
from django.http.multipartparser import MultiPartParserError
|
||||||
from django.urls import get_resolver, get_urlconf
|
from django.urls import get_resolver, get_urlconf
|
||||||
from django.utils.decorators import available_attrs
|
from django.utils.decorators import available_attrs
|
||||||
from django.utils.deprecation import RemovedInDjango20Warning
|
|
||||||
from django.utils.encoding import force_text
|
from django.utils.encoding import force_text
|
||||||
from django.views import debug
|
from django.views import debug
|
||||||
|
|
||||||
|
@ -94,18 +92,7 @@ def response_for_exception(request, exc):
|
||||||
def get_exception_response(request, resolver, status_code, exception, sender=None):
|
def get_exception_response(request, resolver, status_code, exception, sender=None):
|
||||||
try:
|
try:
|
||||||
callback, param_dict = resolver.resolve_error_handler(status_code)
|
callback, param_dict = resolver.resolve_error_handler(status_code)
|
||||||
# Unfortunately, inspect.getargspec result is not trustable enough
|
|
||||||
# depending on the callback wrapping in decorators (frequent for handlers).
|
|
||||||
# Falling back on try/except:
|
|
||||||
try:
|
|
||||||
response = callback(request, **dict(param_dict, exception=exception))
|
response = callback(request, **dict(param_dict, exception=exception))
|
||||||
except TypeError:
|
|
||||||
warnings.warn(
|
|
||||||
"Error handlers should accept an exception parameter. Update "
|
|
||||||
"your code as this parameter will be required in Django 2.0",
|
|
||||||
RemovedInDjango20Warning, stacklevel=2
|
|
||||||
)
|
|
||||||
response = callback(request, **param_dict)
|
|
||||||
except Exception:
|
except Exception:
|
||||||
signals.got_request_exception.send(sender=sender, request=request)
|
signals.got_request_exception.send(sender=sender, request=request)
|
||||||
response = handle_uncaught_exception(request, resolver, sys.exc_info())
|
response = handle_uncaught_exception(request, resolver, sys.exc_info())
|
||||||
|
|
|
@ -285,3 +285,6 @@ these features.
|
||||||
* ``django.template.loaders.filesystem.Loader.get_template_sources()``
|
* ``django.template.loaders.filesystem.Loader.get_template_sources()``
|
||||||
|
|
||||||
* ``django.template.loaders.base.Loader.__call__()`` is removed.
|
* ``django.template.loaders.base.Loader.__call__()`` is removed.
|
||||||
|
|
||||||
|
* Support for custom error views that don't accept an ``exception`` parameter
|
||||||
|
is removed.
|
||||||
|
|
Loading…
Reference in New Issue