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 /django | |
| parent | fa680ce1e252666d125264b2e93782c127ebe8c8 (diff) | |
Fixed #21363 -- Added datetime.timedelta support to TimestampSigner.unsign().
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/signing.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/django/core/signing.py b/django/core/signing.py index d1f204bfc1..d46a386c6d 100644 --- a/django/core/signing.py +++ b/django/core/signing.py @@ -36,6 +36,7 @@ These functions make use of all of them. from __future__ import unicode_literals import base64 +import datetime import json import time import zlib @@ -192,6 +193,8 @@ class TimestampSigner(Signer): value, timestamp = result.rsplit(self.sep, 1) timestamp = baseconv.base62.decode(timestamp) if max_age is not None: + if isinstance(max_age, datetime.timedelta): + max_age = max_age.total_seconds() # Check timestamp is not older than max_age age = time.time() - timestamp if age > max_age: |
