summaryrefslogtreecommitdiff
path: root/django/utils/deprecation.py
diff options
context:
space:
mode:
authorMichael Galler <michael.galler@schnapptack.de>2020-08-20 18:41:22 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-08-26 07:13:49 +0200
commit547a07fa7ec4364ea9ecd2aabfdd16ee4c63003c (patch)
treec34620659c055b19d3948d7a13e5303c8f73af09 /django/utils/deprecation.py
parent0b0658111cba538b91072b9a133fd5545f3f46d1 (diff)
Fixed #31905 -- Made MiddlewareMixin call process_request()/process_response() with thread sensitive.
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
Diffstat (limited to 'django/utils/deprecation.py')
-rw-r--r--django/utils/deprecation.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py
index 3582fcf3a3..b2c681b33c 100644
--- a/django/utils/deprecation.py
+++ b/django/utils/deprecation.py
@@ -126,10 +126,16 @@ class MiddlewareMixin:
"""
response = None
if hasattr(self, 'process_request'):
- response = await sync_to_async(self.process_request)(request)
+ response = await sync_to_async(
+ self.process_request,
+ thread_sensitive=True,
+ )(request)
response = response or await self.get_response(request)
if hasattr(self, 'process_response'):
- response = await sync_to_async(self.process_response)(request, response)
+ response = await sync_to_async(
+ self.process_response,
+ thread_sensitive=True,
+ )(request, response)
return response
def _get_response_none_deprecation(self, get_response):