svn keywords
[plcapi.git] / PLC / PyCurl.py
index 8352fd0..f688bc0 100644 (file)
@@ -6,6 +6,7 @@
 # Copyright (C) 2006 The Trustees of Princeton University
 #
 # $Id$
+# $URL$
 #
 
 import os
@@ -15,6 +16,8 @@ from tempfile import NamedTemporaryFile
 
 class PyCurlTransport(xmlrpclib.Transport):
     def __init__(self, uri, cert = None, timeout = 300):
+        if hasattr(xmlrpclib.Transport,'__init__'):
+            xmlrpclib.Transport.__init__(self)
         self.curl = pycurl.Curl()
 
         # Suppress signals
@@ -64,13 +67,14 @@ class PyCurlTransport(xmlrpclib.Transport):
             errcode = self.curl.getinfo(pycurl.HTTP_CODE)
             response = self.body
             self.body = ""
+            errmsg="<no known errmsg>"
         except pycurl.error, err:
             (errcode, errmsg) = err
 
         if errcode == 60:
-            raise Exception, "SSL certificate validation failed"
+            raise Exception, "PyCurl: SSL certificate validation failed"
         elif errcode != 200:
-            raise Exception, "HTTP error %d" % errcode
+           raise Exception, "PyCurl: HTTP error %d -- %r" % (errcode,errmsg)
 
         # Parse response
         p, u = self.getparser()