Skip to content

Commit 185c346

Browse files
committed
Clean up deprecated Signer usage
1 parent b015ef5 commit 185c346

File tree

1 file changed

+4
-22
lines changed

1 file changed

+4
-22
lines changed

plain/plain/signing.py

+4-22
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@
3737
import datetime
3838
import json
3939
import time
40-
import warnings
4140
import zlib
4241

4342
from plain.runtime import settings
4443
from plain.utils.crypto import constant_time_compare, salted_hmac
45-
from plain.utils.deprecation import RemovedInDjango51Warning
4644
from plain.utils.encoding import force_bytes
4745
from plain.utils.module_loading import import_string
4846
from plain.utils.regex_helper import _lazy_re_compile
@@ -177,17 +175,13 @@ def loads(
177175

178176

179177
class Signer:
180-
# RemovedInDjango51Warning: When the deprecation ends, replace with:
181-
# def __init__(
182-
# self, *, key=None, sep=":", salt=None, algorithm=None, fallback_keys=None
183-
# ):
184178
def __init__(
185179
self,
186-
*args,
180+
*,
187181
key=None,
188182
sep=":",
189183
salt=None,
190-
algorithm=None,
184+
algorithm="sha256",
191185
fallback_keys=None,
192186
):
193187
self.key = key or settings.SECRET_KEY
@@ -198,20 +192,8 @@ def __init__(
198192
)
199193
self.sep = sep
200194
self.salt = salt or f"{self.__class__.__module__}.{self.__class__.__name__}"
201-
self.algorithm = algorithm or "sha256"
202-
# RemovedInDjango51Warning.
203-
if args:
204-
warnings.warn(
205-
f"Passing positional arguments to {self.__class__.__name__} is "
206-
f"deprecated.",
207-
RemovedInDjango51Warning,
208-
stacklevel=2,
209-
)
210-
for arg, attr in zip(
211-
args, ["key", "sep", "salt", "algorithm", "fallback_keys"]
212-
):
213-
if arg or attr == "sep":
214-
setattr(self, attr, arg)
195+
self.algorithm = algorithm
196+
215197
if _SEP_UNSAFE.match(self.sep):
216198
raise ValueError(
217199
"Unsafe Signer separator: %r (cannot be empty or consist of "

0 commit comments

Comments
 (0)