tools/python: fix xm list for Python 2.7

This patch fixes
  Unexpected error: <type 'exceptions.AttributeError'>
This is due to xmlrpc changes in Python 2.7.  This patch should
fixe it for both old and new versions.

Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Michael Young committed 2010-08-19 17:09:30 +01:00
1 parent 90d0bd9ffb
commit 4053efae85
2 files changed
+10 -1

No files matched your search

+7 -1
View File
@@ -22,6 +22,7 @@ import socket
import string
import xmlrpclib
from types import StringTypes
from sys import hexversion
try:
@@ -54,7 +55,12 @@ class UnixTransport(xmlrpclib.Transport):
return xmlrpclib.Transport.request(self, host, '/RPC2',
request_body, verbose)
def make_connection(self, host):
return HTTPUnix(self.__handler)
if hexversion < 0x02070000:
# python 2.6 or earlier
return HTTPUnix(self.__handler)
else:
# xmlrpclib.Transport changed in python 2.7
return HTTPUnixConnection(self.__handler)
# We need our own transport for HTTPS, because xmlrpclib.SafeTransport is
+3
View File
@@ -58,6 +58,9 @@ def stringify(value):
# some bugs in Keep-Alive handling and also enabled it by default
class XMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
protocol_version = "HTTP/1.1"
# xend crashes in python 2.7 unless disable_nagle_algorithm = False
# it isn't used in earlier versions so it is harmless to set it generally
disable_nagle_algorithm = False
def __init__(self, hosts_allowed, request, client_address, server):
self.hosts_allowed = hosts_allowed
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.