mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #33199 -- Deprecated passing positional arguments to Signer/TimestampSigner.
Thanks Jacob Walls for the implementation idea.
This commit is contained in:
committed by
Mariusz Felisiak
parent
3fec3bf90b
commit
b8738aea14
@@ -96,12 +96,12 @@ By default, the ``Signer`` class uses the :setting:`SECRET_KEY` setting to
|
||||
generate signatures. You can use a different secret by passing it to the
|
||||
``Signer`` constructor::
|
||||
|
||||
>>> signer = Signer('my-other-secret')
|
||||
>>> signer = Signer(key='my-other-secret')
|
||||
>>> value = signer.sign('My string')
|
||||
>>> value
|
||||
'My string:EkfQJafvGyiofrdGnuthdxImIJw'
|
||||
|
||||
.. class:: Signer(key=None, sep=':', salt=None, algorithm=None, fallback_keys=None)
|
||||
.. class:: Signer(*, key=None, sep=':', salt=None, algorithm=None, fallback_keys=None)
|
||||
|
||||
Returns a signer which uses ``key`` to generate signatures and ``sep`` to
|
||||
separate values. ``sep`` cannot be in the :rfc:`URL safe base64 alphabet
|
||||
@@ -115,6 +115,10 @@ generate signatures. You can use a different secret by passing it to the
|
||||
|
||||
The ``fallback_keys`` argument was added.
|
||||
|
||||
.. deprecated:: 4.2
|
||||
|
||||
Support for passing positional arguments is deprecated.
|
||||
|
||||
Using the ``salt`` argument
|
||||
---------------------------
|
||||
|
||||
@@ -172,7 +176,7 @@ created within a specified period of time::
|
||||
>>> signer.unsign(value, max_age=timedelta(seconds=20))
|
||||
'hello'
|
||||
|
||||
.. class:: TimestampSigner(key=None, sep=':', salt=None, algorithm='sha256')
|
||||
.. class:: TimestampSigner(*, key=None, sep=':', salt=None, algorithm='sha256')
|
||||
|
||||
.. method:: sign(value)
|
||||
|
||||
@@ -195,6 +199,10 @@ created within a specified period of time::
|
||||
otherwise raises ``SignatureExpired``. The ``max_age`` parameter can
|
||||
accept an integer or a :py:class:`datetime.timedelta` object.
|
||||
|
||||
.. deprecated:: 4.2
|
||||
|
||||
Support for passing positional arguments is deprecated.
|
||||
|
||||
.. _signing-complex-data:
|
||||
|
||||
Protecting complex data structures
|
||||
|
||||
Reference in New Issue
Block a user