From 49688573beced8b0bf5661cb1aede0423df687f6 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 10 Jan 2012 10:30:14 -0500 Subject: properly construct ProxyError to avoid occasional errors on Python 2.6 --- src/lib/Proxy.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib/Proxy.py b/src/lib/Proxy.py index e1406bd99..9d0197798 100644 --- a/src/lib/Proxy.py +++ b/src/lib/Proxy.py @@ -49,18 +49,20 @@ class ProxyError(Exception): the various xmlrpclib errors that might arise (mainly ProtocolError and Fault) """ def __init__(self, err): + msg = None if isinstance(err, xmlrpclib.ProtocolError): # cut out the password in the URL url = re.sub(r'([^:]+):(.*?)@([^@]+:\d+/)', r'\1:******@\3', err.url) - self.message = "XML-RPC Protocol Error for %s: %s (%s)" % \ - (url, err.errmsg, err.errcode) + msg = "XML-RPC Protocol Error for %s: %s (%s)" % (url, + err.errmsg, + err.errcode) elif isinstance(err, xmlrpclib.Fault): - self.message = "XML-RPC Fault: %s (%s)" % (err.faultString, - err.faultCode) + msg = "XML-RPC Fault: %s (%s)" % (err.faultString, + err.faultCode) else: - self.message = str(err) - self.args = (self.message, ) + msg = str(err) + Exception(self, msg) class CertificateError(Exception): def __init__(self, commonName): -- cgit v1.2.3-1-g7c22