diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-01-10 10:30:14 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-01-10 10:30:14 -0500 |
commit | 49688573beced8b0bf5661cb1aede0423df687f6 (patch) | |
tree | 59c5a5b57ddd6208d6ca66eb43a365010050b581 /src/lib/Proxy.py | |
parent | 872122afdb45e8198ef192babf1864a2da1ab021 (diff) | |
download | bcfg2-49688573beced8b0bf5661cb1aede0423df687f6.tar.gz bcfg2-49688573beced8b0bf5661cb1aede0423df687f6.tar.bz2 bcfg2-49688573beced8b0bf5661cb1aede0423df687f6.zip |
properly construct ProxyError to avoid occasional errors on Python 2.6
Diffstat (limited to 'src/lib/Proxy.py')
-rw-r--r-- | src/lib/Proxy.py | 14 |
1 files 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): |