From 4d52eaa4801df3f3169df8e58758bcccf22dc4de Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sat, 17 Jun 2023 19:35:21 +0200 Subject: drop support for Python 2.x --- wsgitools/digest.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'wsgitools/digest.py') diff --git a/wsgitools/digest.py b/wsgitools/digest.py index 5b101e5..6eb4cb3 100644 --- a/wsgitools/digest.py +++ b/wsgitools/digest.py @@ -47,8 +47,7 @@ def gen_rand_str(bytesentropy=33): True """ randnum = randbits(bytesentropy*8) - randstr = ("%%0%dX" % (2*bytesentropy)) % randnum - randbytes = str2bytes(randstr) + randbytes = (b"%%0%dX" % (2*bytesentropy)) % randnum randbytes = base64.b16decode(randbytes) randbytes = base64.b64encode(randbytes) randstr = bytes2str(randbytes) @@ -146,7 +145,7 @@ class StaleNonce(AuthenticationRequired): pass __all__.append("AbstractTokenGenerator") -class AbstractTokenGenerator(object): +class AbstractTokenGenerator: """Interface class for generating authentication tokens for L{AuthDigestMiddleware}. @@ -300,7 +299,7 @@ class UpdatingHtdigestTokenGenerator(HtdigestTokenGenerator): return HtdigestTokenGenerator.__call__(self, user, algo) __all__.append("NonceStoreBase") -class NonceStoreBase(object): +class NonceStoreBase: """Nonce storage interface.""" def __init__(self): pass @@ -516,7 +515,7 @@ class MemoryNonceStore(NonceStoreBase): return True __all__.append("LazyDBAPI2Opener") -class LazyDBAPI2Opener(object): +class LazyDBAPI2Opener: """ Connects to database on first request. Otherwise it behaves like a dbapi2 connection. This may be usefull in combination with L{scgi.forkpool}, -- cgit v1.2.3