diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2019-04-12 06:15:18 -0700 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-06-20 12:29:43 +0200 |
| commit | a415ce70bef6d91036b00dd2c8544aed7aeeaaed (patch) | |
| tree | 3583cef22e9b56d2ed52456ab586d9c47620bc51 /django/test | |
| parent | cce47ff65a4dd3786c049ec14ee889e128ca7de9 (diff) | |
Fixed #30451 -- Added ASGI handler and coroutine-safety.
This adds an ASGI handler, asgi.py file for the default project layout,
a few async utilities and adds async-safety to many parts of Django.
Diffstat (limited to 'django/test')
| -rw-r--r-- | django/test/signals.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/test/signals.py b/django/test/signals.py index a623e756ce..31a5017602 100644 --- a/django/test/signals.py +++ b/django/test/signals.py @@ -1,8 +1,9 @@ import os -import threading import time import warnings +from asgiref.local import Local + from django.apps import apps from django.core.exceptions import ImproperlyConfigured from django.core.signals import setting_changed @@ -26,7 +27,7 @@ COMPLEX_OVERRIDE_SETTINGS = {'DATABASES'} def clear_cache_handlers(**kwargs): if kwargs['setting'] == 'CACHES': from django.core.cache import caches - caches._caches = threading.local() + caches._caches = Local() @receiver(setting_changed) @@ -113,7 +114,7 @@ def language_changed(**kwargs): if kwargs['setting'] in {'LANGUAGES', 'LANGUAGE_CODE', 'LOCALE_PATHS'}: from django.utils.translation import trans_real trans_real._default = None - trans_real._active = threading.local() + trans_real._active = Local() if kwargs['setting'] in {'LANGUAGES', 'LOCALE_PATHS'}: from django.utils.translation import trans_real trans_real._translations = {} |
