Commits

Sylvain Hellegouarch committed af7483c

the method override is not needed from Python 2.7

Comments (0)

Files changed (1)

cherrypy/test/test_xmlrpc.py

 from cherrypy.test import test
 test.prefer_parent_path()
 import xmlrpclib
+import sys
 
 import cherrypy
 
     cherrypy.config.update({'environment': 'test_suite'})
 
 
-class HTTPSTransport(xmlrpclib.SafeTransport):
-    """Subclass of SafeTransport to fix sock.recv errors (by using file)."""
-    
-    def request(self, host, handler, request_body, verbose=0):
-        # issue XML-RPC request
-        h = self.make_connection(host)
-        if verbose:
-            h.set_debuglevel(1)
-        
-        self.send_request(h, handler, request_body)
-        self.send_host(h, host)
-        self.send_user_agent(h)
-        self.send_content(h, request_body)
-        
-        errcode, errmsg, headers = h.getreply()
-        if errcode != 200:
-            raise xmlrpclib.ProtocolError(host + handler, errcode, errmsg,
-                                          headers)
-        
-        self.verbose = verbose
-        
-        # Here's where we differ from the superclass. It says:
-        # try:
-        #     sock = h._conn.sock
-        # except AttributeError:
-        #     sock = None
-        # return self._parse_response(h.getfile(), sock)
-        
-        return self.parse_response(h.getfile())
+if sys.version_info <= (2, 6):
+    class HTTPSTransport(xmlrpclib.SafeTransport):
+        """Subclass of SafeTransport to fix sock.recv errors (by using file)."""
 
+        def request(self, host, handler, request_body, verbose=0):
+            # issue XML-RPC request
+            h = self.make_connection(host)
+            if verbose:
+                h.set_debuglevel(1)
+
+            self.send_request(h, handler, request_body)
+            self.send_host(h, host)
+            self.send_user_agent(h)
+            self.send_content(h, request_body)
+
+            errcode, errmsg, headers = h.getreply()
+            if errcode != 200:
+                raise xmlrpclib.ProtocolError(host + handler, errcode, errmsg,
+                                              headers)
+
+            self.verbose = verbose
+
+            # Here's where we differ from the superclass. It says:
+            # try:
+            #     sock = h._conn.sock
+            # except AttributeError:
+            #     sock = None
+            # return self._parse_response(h.getfile(), sock)
+
+            return self.parse_response(h.getfile())
+else:
+    class HTTPSTransport(xmlrpclib.SafeTransport):
+        pass
 
 from cherrypy.test import helper
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.