Commit b6401f23 authored by niv-openerp's avatar niv-openerp

[imp] added xmlrpcs support

parents 118abfd6 c1071a8f
......@@ -101,6 +101,18 @@ class XmlRPCConnector(Connector):
service = xmlrpclib.ServerProxy(url)
return getattr(service, method)(*args)
class XmlRPCSConnector(XmlRPCConnector):
"""
A type of connector that uses the secured XMLRPC protocol.
"""
PROTOCOL = 'xmlrpcs'
__logger = _getChildLogger(_logger, 'connector.xmlrpcs')
def __init__(self, hostname, port=8071):
super(XmlRPCSConnector, self).__init__(hostname, port)
self.url = 'https://%s:%d/xmlrpc' % (self.hostname, self.port)
class NetRPC_Exception(Exception):
"""
Exception for NetRPC errors.
......@@ -408,15 +420,17 @@ def get_connector(hostname=None, protocol="xmlrpc", port="auto"):
:param port: The number of the port. Defaults to auto.
"""
if port == 'auto':
port = 8069 if protocol=="xmlrpc" else 8070
port = 8069 if protocol=="xmlrpc" else (8070 if protocol == "netrpc" else 8071)
if protocol == "xmlrpc":
return XmlRPCConnector(hostname, port)
elif protocol == "xmlrpcs":
return XmlRPCSConnector(hostname, port)
elif protocol == "netrpc":
return NetRPCConnector(hostname, port)
elif protocol == "local":
return LocalConnector()
else:
raise ValueError("You must choose xmlrpc or netrpc or local")
raise ValueError("You must choose xmlrpc(s), netrpc or local")
def get_connection(hostname=None, protocol="xmlrpc", port='auto', database=None,
login=None, password=None, user_id=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