Commit 92b30b9d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki Committed by Arnaud Fontaine

erp5_web_service: Make code compatible with both python2 and python3.

parent 9a9d005d
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
import os, socket import os, socket
import operator 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 socket import gaierror, error, socket, getaddrinfo, AF_UNSPEC, SOCK_STREAM
from xmlrpclib import Binary from six.moves.xmlrpc_client import Binary
from cStringIO import StringIO from six.moves import cStringIO as StringIO
from paramiko import Transport, RSAKey, SFTPClient from paramiko import Transport, RSAKey, SFTPClient
from paramiko.util import retry_on_signal from paramiko.util import retry_on_signal
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
# #
############################################################################## ##############################################################################
import xmlrpclib from six.moves.xmlrpc_client import ServerProxy
from urlparse import urlparse from six.moves.urllib.parse import urlparse
class XMLRPCConnection: class XMLRPCConnection:
""" """
...@@ -47,4 +47,4 @@ class XMLRPCConnection: ...@@ -47,4 +47,4 @@ class XMLRPCConnection:
schema = urlparse(url) schema = urlparse(url)
url = '%s://%s:%s@%s%s' %(schema[0], self._user_name, self._password, url = '%s://%s:%s@%s%s' %(schema[0], self._user_name, self._password,
schema[1], schema[2]) 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 ...@@ -32,6 +32,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
import six
class ConnectionError(Exception): class ConnectionError(Exception):
pass pass
...@@ -55,7 +56,7 @@ handler_module_dict = { ...@@ -55,7 +56,7 @@ handler_module_dict = {
'sql' : "SQLConnection", 'sql' : "SQLConnection",
'document' : "DocumentConnection", '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. # Ignore non-functionnal plugins.
# This is done to avoid adding strict dependencies. # This is done to avoid adding strict dependencies.
# Code relying on the presence of a plugin will fail upon # 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