summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCollin Anderson <cmawebsite@gmail.com>2014-10-09 11:46:40 -0400
committerTim Graham <timograham@gmail.com>2014-12-24 07:18:43 -0500
commit5dddd79433ceb88ab67d9851b49a44ce5b8f509c (patch)
treeabe462b79ba9e8f1b1975d51e39c0385eb05628e
parentc5c235cd4fcf4f4c3cbef992b1f92c5930bb4223 (diff)
Fixed #20349 -- Moved setting_changed signal to django.core.signals.
This removes the need to load django.test when not testing.
-rw-r--r--django/contrib/auth/hashers.py2
-rw-r--r--django/core/signals.py1
-rw-r--r--django/test/signals.py3
-rw-r--r--django/utils/translation/trans_real.py2
-rw-r--r--docs/ref/signals.txt7
-rw-r--r--docs/releases/1.8.txt4
6 files changed, 15 insertions, 4 deletions
diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py
index 04f15b0b4f..9a85ebbbad 100644
--- a/django/contrib/auth/hashers.py
+++ b/django/contrib/auth/hashers.py
@@ -8,7 +8,7 @@ import importlib
from django.dispatch import receiver
from django.conf import settings
-from django.test.signals import setting_changed
+from django.core.signals import setting_changed
from django.utils.encoding import force_bytes, force_str, force_text
from django.core.exceptions import ImproperlyConfigured
from django.utils.crypto import (
diff --git a/django/core/signals.py b/django/core/signals.py
index c530a51f08..5d9618dd0c 100644
--- a/django/core/signals.py
+++ b/django/core/signals.py
@@ -3,3 +3,4 @@ from django.dispatch import Signal
request_started = Signal(providing_args=["environ"])
request_finished = Signal()
got_request_exception = Signal(providing_args=["request"])
+setting_changed = Signal(providing_args=["setting", "value", "enter"])
diff --git a/django/test/signals.py b/django/test/signals.py
index 6e7b88bfb0..d8a864d1f4 100644
--- a/django/test/signals.py
+++ b/django/test/signals.py
@@ -4,6 +4,7 @@ import threading
import warnings
from django.conf import settings
+from django.core.signals import setting_changed
from django.db import connections, router
from django.db.utils import ConnectionRouter
from django.dispatch import receiver, Signal
@@ -12,8 +13,6 @@ from django.utils.functional import empty
template_rendered = Signal(providing_args=["template", "context"])
-setting_changed = Signal(providing_args=["setting", "value", "enter"])
-
# Most setting_changed receivers are supposed to be added below,
# except for cases where the receiver is related to a contrib app.
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 9f00d36de5..2af2f1dd35 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -13,8 +13,8 @@ from django.apps import apps
from django.conf import settings
from django.conf.locale import LANG_INFO
from django.core.exceptions import AppRegistryNotReady
+from django.core.signals import setting_changed
from django.dispatch import receiver
-from django.test.signals import setting_changed
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.encoding import force_text
from django.utils._os import upath
diff --git a/docs/ref/signals.txt b/docs/ref/signals.txt
index b41b3f63dd..84bb7f570e 100644
--- a/docs/ref/signals.txt
+++ b/docs/ref/signals.txt
@@ -666,6 +666,13 @@ It's actually sent twice: when the new value is applied ("setup") and when the
original value is restored ("teardown"). Use the ``enter`` argument to
distinguish between the two.
+You can also import this signal from ``django.core.signals`` to avoid importing
+from ``django.test`` in non-test situations.
+
+.. versionchanged:: 1.8
+
+ The signal was moved to ``django.core.signals`` as described above.
+
Arguments sent with this signal:
``sender``
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index e2cb8cd2ff..26fc2c17a2 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -460,6 +460,10 @@ Signals
the request, was added to the :data:`~django.core.signals.request_started`
signal.
+* You can now import the :func:`~django.test.signals.setting_changed` signal
+ from ``django.core.signals`` to avoid loading ``django.test`` in non-test
+ situations. Django no longer does so itself.
+
System Check Framework
^^^^^^^^^^^^^^^^^^^^^^