diff options
| author | Berker Peksag <berker.peksag@gmail.com> | 2014-11-15 12:03:04 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-11-15 19:36:33 +0100 |
| commit | d2d6c0c097072e2a8ece755fdc2d50c111104e7d (patch) | |
| tree | f5d2cf4ff979c3de21a391c0be66bcdb6b80348e /docs/topics | |
| parent | fa680ce1e252666d125264b2e93782c127ebe8c8 (diff) | |
Fixed #21363 -- Added datetime.timedelta support to TimestampSigner.unsign().
Diffstat (limited to 'docs/topics')
| -rw-r--r-- | docs/topics/signing.txt | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/docs/topics/signing.txt b/docs/topics/signing.txt index 3092f297f0..18d963c41b 100644 --- a/docs/topics/signing.txt +++ b/docs/topics/signing.txt @@ -114,6 +114,7 @@ Verifying timestamped values timestamp to the value. This allows you to confirm that a signed value was created within a specified period of time:: + >>> from datetime import timedelta >>> from django.core.signing import TimestampSigner >>> signer = TimestampSigner() >>> value = signer.sign('hello') @@ -126,6 +127,8 @@ created within a specified period of time:: SignatureExpired: Signature age 15.5289158821 > 10 seconds >>> signer.unsign(value, max_age=20) 'hello' + >>> signer.unsign(value, max_age=timedelta(seconds=20)) + 'hello' .. class:: TimestampSigner(key=None, sep=':', salt=None) @@ -136,7 +139,12 @@ created within a specified period of time:: .. method:: unsign(value, max_age=None) Checks if ``value`` was signed less than ``max_age`` seconds ago, - otherwise raises ``SignatureExpired``. + otherwise raises ``SignatureExpired``. The ``max_age`` parameter can + accept an integer or a :py:class:`datetime.timedelta` object. + + .. versionchanged:: 1.8 + + Previously, the ``max_age`` parameter only accepted an integer. Protecting complex data structures ---------------------------------- |
