Commit 5dddd794 authored by Collin Anderson's avatar Collin Anderson Committed by Tim Graham
Browse files

Fixed #20349 -- Moved setting_changed signal to django.core.signals.

This removes the need to load django.test when not testing.
parent c5c235cd
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 (
+1 −0
Original line number Diff line number Diff line
@@ -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"])
+1 −2
Original line number Diff line number Diff line
@@ -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.

+1 −1
Original line number Diff line number Diff line
@@ -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
+7 −0
Original line number Diff line number Diff line
@@ -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``
Loading