Improve Python 3.x compatibility
Some mechanical translation of the deprecated except x,y construct. Should work with Python >= 2.6 just fine Change-Id: I394f9956b9e3e3d9f5f1e9ad50c35b13200af2a1
This commit is contained in:
@@ -348,14 +348,14 @@ class VerifiedHTTPSConnection(httplib.HTTPSConnection):
|
||||
if self.cert_file:
|
||||
try:
|
||||
self.context.use_certificate_file(self.cert_file)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
msg = 'Unable to load cert from "%s" %s' % (self.cert_file, e)
|
||||
raise exc.SSLConfigurationError(msg)
|
||||
if self.key_file is None:
|
||||
# We support having key and cert in same file
|
||||
try:
|
||||
self.context.use_privatekey_file(self.cert_file)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
msg = ('No key file specified and unable to load key '
|
||||
'from "%s" %s' % (self.cert_file, e))
|
||||
raise exc.SSLConfigurationError(msg)
|
||||
@@ -363,14 +363,14 @@ class VerifiedHTTPSConnection(httplib.HTTPSConnection):
|
||||
if self.key_file:
|
||||
try:
|
||||
self.context.use_privatekey_file(self.key_file)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
msg = 'Unable to load key from "%s" %s' % (self.key_file, e)
|
||||
raise exc.SSLConfigurationError(msg)
|
||||
|
||||
if self.cacert:
|
||||
try:
|
||||
self.context.load_verify_locations(self.cacert)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
msg = 'Unable to load CA from "%s"' % (self.cacert, e)
|
||||
raise exc.SSLConfigurationError(msg)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user