From 3cee9edd1b3e1a11ecdfeecef6f2247c10c859fb Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sat, 31 Dec 2016 07:05:37 -0500 Subject: [PATCH] Refs #24733 -- Removed support for error views without the exception parameter. Per deprecation timeline. --- django/core/handlers/exception.py | 15 +-------------- docs/releases/2.0.txt | 3 +++ 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/django/core/handlers/exception.py b/django/core/handlers/exception.py index f1c7b578912..ab859405f38 100644 --- a/django/core/handlers/exception.py +++ b/django/core/handlers/exception.py @@ -2,7 +2,6 @@ from __future__ import unicode_literals import logging import sys -import warnings from functools import wraps from django.conf import settings @@ -12,7 +11,6 @@ from django.http import Http404 from django.http.multipartparser import MultiPartParserError from django.urls import get_resolver, get_urlconf from django.utils.decorators import available_attrs -from django.utils.deprecation import RemovedInDjango20Warning from django.utils.encoding import force_text 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): try: 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)) - 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) + response = callback(request, **dict(param_dict, exception=exception)) except Exception: signals.got_request_exception.send(sender=sender, request=request) response = handle_uncaught_exception(request, resolver, sys.exc_info()) diff --git a/docs/releases/2.0.txt b/docs/releases/2.0.txt index a6d85697b50..aec9e913922 100644 --- a/docs/releases/2.0.txt +++ b/docs/releases/2.0.txt @@ -285,3 +285,6 @@ these features. * ``django.template.loaders.filesystem.Loader.get_template_sources()`` * ``django.template.loaders.base.Loader.__call__()`` is removed. + +* Support for custom error views that don't accept an ``exception`` parameter + is removed.