summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-01-12 20:55:32 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-01-14 17:50:04 +0100
commit4bb30fe5d598a7acd2a3055c5e66224cf42a75e9 (patch)
treee46ebaa8e16debbcde2eeb70ca1a9db55e8f8f27 /django/utils
parent6b4941dd577c494cfa49dbeacfd33594ae770047 (diff)
Refs #26601 -- Made get_response argument required and don't accept None in middleware classes.
Per deprecation timeline.
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/deprecation.py15
1 files changed, 3 insertions, 12 deletions
diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py
index b2c681b33c..bc715e91d3 100644
--- a/django/utils/deprecation.py
+++ b/django/utils/deprecation.py
@@ -89,10 +89,9 @@ class MiddlewareMixin:
sync_capable = True
async_capable = True
- # RemovedInDjango40Warning: when the deprecation ends, replace with:
- # def __init__(self, get_response):
- def __init__(self, get_response=None):
- self._get_response_none_deprecation(get_response)
+ def __init__(self, get_response):
+ if get_response is None:
+ raise ValueError('get_response must be provided.')
self.get_response = get_response
self._async_check()
super().__init__()
@@ -137,11 +136,3 @@ class MiddlewareMixin:
thread_sensitive=True,
)(request, response)
return response
-
- def _get_response_none_deprecation(self, get_response):
- if get_response is None:
- warnings.warn(
- 'Passing None for the middleware get_response argument is '
- 'deprecated.',
- RemovedInDjango40Warning, stacklevel=3,
- )