Refs #31327 -- Removed providing_args argument for Signal per deprecation timeline.
This commit is contained in:
parent
4bb30fe5d5
commit
1adcf20385
|
@ -1,9 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
import threading
|
import threading
|
||||||
import warnings
|
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from django.utils.deprecation import RemovedInDjango40Warning
|
|
||||||
from django.utils.inspect import func_accepts_kwargs
|
from django.utils.inspect import func_accepts_kwargs
|
||||||
|
|
||||||
logger = logging.getLogger('django.dispatch')
|
logger = logging.getLogger('django.dispatch')
|
||||||
|
@ -30,19 +28,11 @@ class Signal:
|
||||||
receivers
|
receivers
|
||||||
{ receiverkey (id) : weakref(receiver) }
|
{ receiverkey (id) : weakref(receiver) }
|
||||||
"""
|
"""
|
||||||
def __init__(self, providing_args=None, use_caching=False):
|
def __init__(self, use_caching=False):
|
||||||
"""
|
"""
|
||||||
Create a new signal.
|
Create a new signal.
|
||||||
"""
|
"""
|
||||||
self.receivers = []
|
self.receivers = []
|
||||||
if providing_args is not None:
|
|
||||||
warnings.warn(
|
|
||||||
'The providing_args argument is deprecated. As it is purely '
|
|
||||||
'documentational, it has no replacement. If you rely on this '
|
|
||||||
'argument as documentation, you can move the text to a code '
|
|
||||||
'comment or docstring.',
|
|
||||||
RemovedInDjango40Warning, stacklevel=2,
|
|
||||||
)
|
|
||||||
self.lock = threading.Lock()
|
self.lock = threading.Lock()
|
||||||
self.use_caching = use_caching
|
self.use_caching = use_caching
|
||||||
# For convenience we create empty caches even if they are not used.
|
# For convenience we create empty caches even if they are not used.
|
||||||
|
|
|
@ -299,3 +299,5 @@ to remove usage of these features.
|
||||||
* The ``get_request`` argument for
|
* The ``get_request`` argument for
|
||||||
``django.utils.deprecation.MiddlewareMixin.__init__()`` is required and
|
``django.utils.deprecation.MiddlewareMixin.__init__()`` is required and
|
||||||
doesn't accept ``None``.
|
doesn't accept ``None``.
|
||||||
|
|
||||||
|
* The ``providing_args`` argument for ``django.dispatch.Signal`` is removed.
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
import warnings
|
|
||||||
|
|
||||||
from django.dispatch import Signal
|
|
||||||
from django.test import SimpleTestCase
|
|
||||||
from django.utils.deprecation import RemovedInDjango40Warning
|
|
||||||
|
|
||||||
|
|
||||||
class SignalDeprecationTests(SimpleTestCase):
|
|
||||||
def test_providing_args_warning(self):
|
|
||||||
msg = (
|
|
||||||
'The providing_args argument is deprecated. As it is purely '
|
|
||||||
'documentational, it has no replacement. If you rely on this '
|
|
||||||
'argument as documentation, you can move the text to a code '
|
|
||||||
'comment or docstring.'
|
|
||||||
)
|
|
||||||
with self.assertWarnsMessage(RemovedInDjango40Warning, msg):
|
|
||||||
Signal(providing_args=['arg1', 'arg2'])
|
|
||||||
|
|
||||||
def test_without_providing_args_does_not_warn(self):
|
|
||||||
with warnings.catch_warnings(record=True) as recorded:
|
|
||||||
Signal()
|
|
||||||
self.assertEqual(len(recorded), 0)
|
|
Loading…
Reference in New Issue