summaryrefslogtreecommitdiff
path: root/wsgitools/digest.py
diff options
context:
space:
mode:
authorHelmut Grohne <helmut@subdivi.de>2023-06-17 19:35:21 +0200
committerHelmut Grohne <helmut@subdivi.de>2023-06-18 22:44:01 +0200
commit4d52eaa4801df3f3169df8e58758bcccf22dc4de (patch)
treeb8740a88e380a750d9d2607bb39cbc759a8d7175 /wsgitools/digest.py
parent682ce67b73453809237532a7ce2feee07f2900d5 (diff)
downloadwsgitools-4d52eaa4801df3f3169df8e58758bcccf22dc4de.tar.gz
drop support for Python 2.x
Diffstat (limited to 'wsgitools/digest.py')
-rw-r--r--wsgitools/digest.py9
1 files changed, 4 insertions, 5 deletions
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},