tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

xentools3 patch



Hi

xentools3 breaks with python 2.7. It says "AttributeError: HTTPUnix
instance has no attribute 'getresponse' "

Looking for this message on the web yield a patch. I tested it and it
fixes my problem. Is it reasonable to add it to the xentools3 package?


--- lib/python2.7/site-packages/xen/util/xmlrpcclient.py.orig
+++ lib/python2.7/site-packages/xen/util/xmlrpcclient.py
@@ -21,8 +21,9 @@
 import socket
 import string
 import xmlrpclib
 from types import StringTypes
+from sys import hexversion
 
 
 try:
     import SSHTransport
@@ -53,9 +54,12 @@
         self.__handler = handler
         return xmlrpclib.Transport.request(self, host, '/RPC2',
                                            request_body, verbose)
     def make_connection(self, host):
-        return HTTPUnix(self.__handler)
+        if hexversion < 0x02070000:
+            return HTTPUnix(self.__handler)
+        else:
+            return HTTPUnixConnection(self.__handler)
 
 
 # We need our own transport for HTTPS, because xmlrpclib.SafeTransport
is
 # broken -- it does not handle ERROR_ZERO_RETURN properly.
--- lib/python2.7/site-packages/xen/util/xmlrpclib2.py.orig
+++ lib/python2.7/site-packages/xen/util/xmlrpclib2.py
@@ -60,8 +60,9 @@
     protocol_version = "HTTP/1.1"
 
     def __init__(self, hosts_allowed, request, client_address, server):
         self.hosts_allowed = hosts_allowed
+        self.disable_nagle_algorithm = False
         SimpleXMLRPCRequestHandler.__init__(self, request,
client_address,
                                             server)
 
     # this is inspired by SimpleXMLRPCRequestHandler's do_POST but
differs

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index