summaryrefslogtreecommitdiff
path: root/wsgitools/digest.py
diff options
context:
space:
mode:
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},