Commit a3847a71 authored by Jérome Perrin's avatar Jérome Perrin

web_service: py3

parent b533aefd
......@@ -26,7 +26,7 @@
#
##############################################################################
from erp5.component.tool.WebServiceTool import ConnectionError
from erp5.component.tool.WebServiceTool import WebServiceConnectionError
from Products.ERP5.ERP5Site import getSite
class MethodWrapper(object):
......@@ -45,11 +45,11 @@ class MethodWrapper(object):
return method.absolute_url(), response
## try:
## except ValueError, msg:
## raise ConnectionError(msg)
## raise WebServiceConnectionError(msg)
## except Exception, msg:
## raise ConnectionError(msg)
## raise WebServiceConnectionError(msg)
else:
raise ConnectionError("Method %s does not exist" %(method_name))
raise WebServiceConnectionError("Method %s does not exist" %(method_name))
class DocumentConnection:
"""
......
......@@ -40,7 +40,7 @@ class SFTPError(Exception):
"""
Default exception for the connection
"""
pass
class SFTPConnection:
"""
......
......@@ -27,6 +27,8 @@
##############################################################################
from Products.ERP5.ERP5Site import getSite
from erp5.component.tool.WebServiceTool import WebServiceConnectionError
class MethodWrapper(object):
......@@ -42,8 +44,8 @@ class MethodWrapper(object):
response = method(*args, **kw)
return method.absolute_url(), response
else:
from erp5.component.tool.WebServiceTool import ConnectionError
raise ConnectionError("Method %s does not exist" %(method_name))
raise WebServiceConnectionError("Method %s does not exist" %(method_name))
class SQLConnection:
"""
......@@ -52,10 +54,6 @@ class SQLConnection:
"""
__allow_access_to_unprotected_subobjects__ = 1
def __init__(self, *args, **kw):
""" Do nothing """
pass
def connect(self):
"""Get a handle to a remote connection."""
return self
......
......@@ -34,8 +34,10 @@ from Products.ERP5Type.Tool.BaseTool import BaseTool
from Products.ERP5Type import Permissions
import six
class ConnectionError(Exception):
pass
class WebServiceConnectionError(Exception):
"""Error when connecting
"""
connection_plugin_registry = {}
......@@ -92,9 +94,7 @@ class WebServiceTool(BaseTool):
"""
Return list of available connection plugins
"""
plugin_list = connection_plugin_registry.keys()
plugin_list.sort()
return plugin_list
return sorted(connection_plugin_registry.keys())
security.declareProtected(Permissions.ManagePortal, 'connect')
def connect(self, url, user_name=None, password=None, transport=None, transport_kw=None):
......
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