1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Fixed #31327 -- Deprecated providing_args argument for Signal.

This commit is contained in:
Jon Dufresne
2020-03-01 09:22:03 -08:00
committed by Carlton Gibson
parent 5ca76baa72
commit 769cee5252
12 changed files with 68 additions and 47 deletions

View File

@@ -1,6 +1,8 @@
import threading
import warnings
import weakref
from django.utils.deprecation import RemovedInDjango40Warning
from django.utils.inspect import func_accepts_kwargs
@@ -28,14 +30,16 @@ class Signal:
def __init__(self, providing_args=None, use_caching=False):
"""
Create a new signal.
providing_args
A list of the arguments this signal can pass along in a send() call.
"""
self.receivers = []
if providing_args is None:
providing_args = []
self.providing_args = set(providing_args)
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.use_caching = use_caching
# For convenience we create empty caches even if they are not used.
@@ -187,9 +191,7 @@ class Signal:
occur).
named
Named arguments which will be passed to receivers. These
arguments must be a subset of the argument names defined in
providing_args.
Named arguments which will be passed to receivers.
Return a list of tuple pairs [(receiver, response), ... ].