diff options
author | Dolph Mathews <dolph.mathews@gmail.com> | 2012-11-05 10:52:57 -0600 |
---|---|---|
committer | Dolph Mathews <dolph.mathews@gmail.com> | 2012-11-05 10:52:57 -0600 |
commit | 5761a2c55ddea29d47594365f31b69683cd4d5dd (patch) | |
tree | 6e564b615a813ad4fe1eea4b595db65233d1e228 /keystone/middleware | |
parent | a6ef09d94300718197a4fa8757fd3a7a45876963 (diff) | |
download | keystone-5761a2c55ddea29d47594365f31b69683cd4d5dd.tar.gz keystone-5761a2c55ddea29d47594365f31b69683cd4d5dd.tar.xz keystone-5761a2c55ddea29d47594365f31b69683cd4d5dd.zip |
HACKING compliance: consistent use of 'except'
Change-Id: I8301043965e08ffdec63441e612628d9a60876b7
Diffstat (limited to 'keystone/middleware')
-rw-r--r-- | keystone/middleware/auth_token.py | 6 | ||||
-rw-r--r-- | keystone/middleware/core.py | 2 | ||||
-rw-r--r-- | keystone/middleware/s3_token.py | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/keystone/middleware/auth_token.py b/keystone/middleware/auth_token.py index e8ed99b3..cd9b8066 100644 --- a/keystone/middleware/auth_token.py +++ b/keystone/middleware/auth_token.py @@ -286,7 +286,7 @@ class AuthProtocol(object): LOG.info('Invalid user token - rejecting request') return self._reject_request(env, start_response) - except ServiceError, e: + except ServiceError as e: LOG.critical('Unable to obtain admin token: %s' % e) resp = webob.exc.HTTPServiceUnavailable() return resp(env, start_response) @@ -378,7 +378,7 @@ class AuthProtocol(object): conn.request(method, path) response = conn.getresponse() body = response.read() - except Exception, e: + except Exception as e: LOG.error('HTTP connection exception: %s' % e) raise ServiceError('Unable to communicate with keystone') finally: @@ -418,7 +418,7 @@ class AuthProtocol(object): conn.request(method, full_path, **kwargs) response = conn.getresponse() body = response.read() - except Exception, e: + except Exception as e: LOG.error('HTTP connection exception: %s' % e) raise ServiceError('Unable to communicate with keystone') finally: diff --git a/keystone/middleware/core.py b/keystone/middleware/core.py index 6f8abff2..a49f743b 100644 --- a/keystone/middleware/core.py +++ b/keystone/middleware/core.py @@ -147,7 +147,7 @@ class XmlBodyMiddleware(wsgi.Middleware): try: body_obj = jsonutils.loads(response.body) response.body = serializer.to_xml(body_obj) - except: + except Exception: raise exception.Error(message=response.body) return response diff --git a/keystone/middleware/s3_token.py b/keystone/middleware/s3_token.py index 7cf2e394..0f207b3d 100644 --- a/keystone/middleware/s3_token.py +++ b/keystone/middleware/s3_token.py @@ -99,7 +99,7 @@ class S3Token(object): headers=headers) response = conn.getresponse() output = response.read() - except Exception, e: + except Exception as e: self.logger.info('HTTP connection exception: %s' % e) resp = self.deny_request('InvalidURI') raise ServiceError(resp) @@ -143,7 +143,7 @@ class S3Token(object): auth_header = req.headers['Authorization'] try: access, signature = auth_header.split(' ')[-1].rsplit(':', 1) - except(ValueError): + except ValueError: msg = 'You have an invalid Authorization header: %s' self.logger.debug(msg % (auth_header)) return self.deny_request('InvalidURI')(environ, start_response) |