diff options
author | Helmut Grohne <helmut@subdivi.de> | 2012-06-28 16:12:52 +0200 |
---|---|---|
committer | Helmut Grohne <helmut@subdivi.de> | 2012-06-28 16:12:52 +0200 |
commit | ee5abb0e0b24b4e1ac31412a279a40e166482fce (patch) | |
tree | 011e53de9cccec90864052c9bb6506f6b6ac31c9 /wsgitools/digest.py | |
parent | 17dbb95ded62f9789a60a913c008ce2217f6d1a5 (diff) | |
download | wsgitools-ee5abb0e0b24b4e1ac31412a279a40e166482fce.tar.gz |
drop support for python2.5, use except ... as ...
Diffstat (limited to 'wsgitools/digest.py')
-rw-r--r-- | wsgitools/digest.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/wsgitools/digest.py b/wsgitools/digest.py index 085047f..4b5f8fb 100644 --- a/wsgitools/digest.py +++ b/wsgitools/digest.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 """ This module contains an C{AuthDigestMiddleware} for authenticating HTTP requests using the method described in RFC2617. The credentials are to be @@ -259,7 +258,7 @@ class UpdatingHtdigestTokenGenerator(HtdigestTokenGenerator): # modifications. try: self.statcache = os.stat(htdigestfile) - except OSError, err: + except OSError as err: raise IOError(str(err)) HtdigestTokenGenerator.__init__(self, realm, htdigestfile, ignoreparseerrors) @@ -276,7 +275,9 @@ class UpdatingHtdigestTokenGenerator(HtdigestTokenGenerator): if self.statcache != statcache: try: self.readhtdigest(self.htdigestfile, self.ignoreparseerrors) - except (IOError, ValueError): + except IOError: + return None + except ValueError: return None return HtdigestTokenGenerator.__call__(self, user, algo) @@ -724,7 +725,7 @@ class AuthDigestMiddleware(AuthenticationMiddleware): try: nonce = credentials["nonce"] credresponse = credentials["response"] - except KeyError, err: + except KeyError as err: raise ProtocolViolation("%s missing in credentials" % err.args[0]) noncecount = 1 @@ -765,7 +766,7 @@ class AuthDigestMiddleware(AuthenticationMiddleware): username = credentials["username"] algo = credentials["algorithm"] uri = credentials["uri"] - except KeyError, err: + except KeyError as err: raise ProtocolViolation("%s missing in credentials" % err.args[0]) try: dig = [credentials["nonce"]] @@ -778,7 +779,7 @@ class AuthDigestMiddleware(AuthenticationMiddleware): try: dig.append(credentials["nc"]) dig.append(credentials["cnonce"]) - except KeyError, err: + except KeyError as err: raise ProtocolViolation( "missing %s in credentials with qop=auth" % err.args[0]) dig.append(qop) |