Commit 7f9e56cf authored by Vincent Pelletier's avatar Vincent Pelletier Committed by Vincent Pelletier

all: Reduce differences with python3.

Using only 2to3 conversions which are python2-compatible.
parent 719959e0
......@@ -625,7 +625,7 @@ class CertificateAuthority(object):
self._renewCAIfNeeded()
result = []
iter_key_pair = iter(self._ca_key_pairs_list)
first_key_pair = iter_key_pair.next()
first_key_pair = next(iter_key_pair)
previous_crt_pem = utils.dump_certificate(first_key_pair['crt'])
previous_key = first_key_pair['key']
for key_pair in iter_key_pair:
......
This diff is collapsed.
......@@ -107,7 +107,7 @@ def canConnect(address): # pragma: no cover
"""
try:
socket.create_connection(address)
except socket.error, e:
except socket.error as e:
if e.errno == errno.ECONNREFUSED:
return False
raise
......@@ -334,7 +334,7 @@ class CaucaseTest(unittest.TestCase):
new_key_path,
),
)
except SystemExit, e:
except SystemExit as e:
return e.code # pragma: no cover
except: # pylint: disable=bare-except
return 1
......@@ -896,7 +896,7 @@ class CaucaseTest(unittest.TestCase):
client = CaucaseClient(self._caucase_url + '/cas')
try:
client.createCertificateSigningRequest('Not actually a CSR')
except CaucaseError, e:
except CaucaseError as e:
self.assertEqual(e.args[0], 400, e)
else: # pragma: no cover
raise AssertionError('Did not raise CaucaseError(400, ...)')
......
......@@ -264,7 +264,7 @@ def _verifyCertificateChain(cert, trusted_cert_list, crl):
except (
crypto.X509StoreContextError,
crypto.Error,
), e:
) as e:
raise CertificateVerificationError(
'Certificate verification error: %s' % str(e),
)
......
......@@ -572,13 +572,13 @@ class Application(object):
raise InsufficientStorage
except exceptions.NotJSON:
raise BadRequest('Invalid json payload')
except exceptions.CertificateAuthorityException, e:
except exceptions.CertificateAuthorityException as e:
raise BadRequest(str(e))
except Exception:
environ['wsgi.errors'].write('Unhandled exception\n')
traceback.print_exc(file=environ['wsgi.errors'])
raise ApplicationError
except ApplicationError, e:
except ApplicationError as e:
status = e.status
header_list = e.response_headers
result = [str(x) for x in e.args]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment