Skip to content

Commit

Permalink
django.utils.baseconv.base62 -> django.core.signing.b62_*
Browse files Browse the repository at this point in the history
  • Loading branch information
theunraveler committed Apr 6, 2023
1 parent 85baacc commit e18222f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions django_q/core_signing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
from django.core.signing import Signer as Sgnr
from django.core.signing import TimestampSigner as TsS
from django.core.signing import b64_decode, dumps
from django.utils import baseconv
# The `django.utils.baseconv` module is deprecated in Django 4.0 and removed in
# Django 5.0. Base 62 functions have been moved to `django.core.signing`.
try:
from django.core.signing import b62_decode
except ImportError:
from django.utils.baseconv.base62 import decode as b62_decode
from django.utils.crypto import constant_time_compare
from django.utils.encoding import force_bytes, force_str

Expand Down Expand Up @@ -69,7 +74,7 @@ def unsign(self, value, max_age=None):
"""
result = super(TimestampSigner, self).unsign(value)
value, timestamp = result.rsplit(self.sep, 1)
timestamp = baseconv.base62.decode(timestamp)
timestamp = b62_decode(timestamp)
if max_age is not None:
if isinstance(max_age, datetime.timedelta):
max_age = max_age.total_seconds()
Expand Down

0 comments on commit e18222f

Please sign in to comment.