37
37
import datetime
38
38
import json
39
39
import time
40
- import warnings
41
40
import zlib
42
41
43
42
from plain .runtime import settings
44
43
from plain .utils .crypto import constant_time_compare , salted_hmac
45
- from plain .utils .deprecation import RemovedInDjango51Warning
46
44
from plain .utils .encoding import force_bytes
47
45
from plain .utils .module_loading import import_string
48
46
from plain .utils .regex_helper import _lazy_re_compile
@@ -177,17 +175,13 @@ def loads(
177
175
178
176
179
177
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
- # ):
184
178
def __init__ (
185
179
self ,
186
- * args ,
180
+ * ,
187
181
key = None ,
188
182
sep = ":" ,
189
183
salt = None ,
190
- algorithm = None ,
184
+ algorithm = "sha256" ,
191
185
fallback_keys = None ,
192
186
):
193
187
self .key = key or settings .SECRET_KEY
@@ -198,20 +192,8 @@ def __init__(
198
192
)
199
193
self .sep = sep
200
194
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
+
215
197
if _SEP_UNSAFE .match (self .sep ):
216
198
raise ValueError (
217
199
"Unsafe Signer separator: %r (cannot be empty or consist of "
0 commit comments