Commit 2a31f09a authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Jérome Perrin

erp5_web_service: Make code compatible with both python2 and python3.

parent a12f2ddf
......@@ -29,10 +29,10 @@
import os, socket
import operator
from urlparse import urlparse
from six.moves.urllib.parse import urlparse
from socket import gaierror, error, socket, getaddrinfo, AF_UNSPEC, SOCK_STREAM
from xmlrpclib import Binary
from cStringIO import StringIO
from six.moves.xmlrpc_client import Binary
from six.moves import cStringIO as StringIO
from paramiko import Transport, RSAKey, SFTPClient
from paramiko.util import retry_on_signal
......
......@@ -26,8 +26,8 @@
#
##############################################################################
import xmlrpclib
from urlparse import urlparse
from six.moves.xmlrpc_client import ServerProxy
from six.moves.urllib.parse import urlparse
class XMLRPCConnection:
"""
......@@ -47,4 +47,4 @@ class XMLRPCConnection:
schema = urlparse(url)
url = '%s://%s:%s@%s%s' %(schema[0], self._user_name, self._password,
schema[1], schema[2])
return xmlrpclib.ServerProxy(url, allow_none=1)
return ServerProxy(url, allow_none=1)
......@@ -32,6 +32,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type import Permissions
import six
class ConnectionError(Exception):
pass
......@@ -55,7 +56,7 @@ handler_module_dict = {
'sql' : "SQLConnection",
'document' : "DocumentConnection",
}
for handler_id, module_id in handler_module_dict.iteritems():
for handler_id, module_id in six.iteritems(handler_module_dict):
# Ignore non-functionnal plugins.
# This is done to avoid adding strict dependencies.
# Code relying on the presence of a plugin will fail upon
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment