Commit 4c94fc30 authored by niv-openerp's avatar niv-openerp

[imp] added local connector

parents 268f9b12 ffb5a589
......@@ -38,6 +38,7 @@ Code repository:
import xmlrpclib
import logging
import socket
import sys
import cPickle as pickle
......@@ -198,6 +199,31 @@ class NetRPCConnector(Connector):
return result
class LocalConnector(Connector):
A type of connector that uses the XMLRPC protocol.
PROTOCOL = 'local'
__logger = _getChildLogger(_logger, 'connector.local')
def __init__(self):
def send(self, service_name, method, *args):
import openerp
# TODO Exception handling
# This will be changed to be xmlrpc compatible
# OpenERPWarning code 1
# OpenERPException code 2
result = openerp.netsvc.dispatch_rpc(service_name, method, args)
exc_type, exc_value, exc_tb = sys.exc_info()
fault = xmlrpclib.Fault(1, "%s:%s" % (exc_type, exc_value))
raise fault
return result
class Service(object):
A class to execute RPC calls on a specific service of the remote server.
......@@ -371,7 +397,7 @@ class Model(object):
records =, fields or [], context or {})
return records
def get_connector(hostname, protocol="xmlrpc", port="auto"):
def get_connector(hostname=None, protocol="xmlrpc", port="auto"):
A shortcut method to easily create a connector to a remote server using XMLRPC or NetRPC.
......@@ -385,10 +411,12 @@ def get_connector(hostname, protocol="xmlrpc", port="auto"):
return XmlRPCConnector(hostname, port)
elif protocol == "netrpc":
return NetRPCConnector(hostname, port)
elif protocol == "local":
return LocalConnector()
raise ValueError("You must choose xmlrpc or netrpc")
raise ValueError("You must choose xmlrpc or netrpc or local")
def get_connection(hostname, protocol="xmlrpc", port='auto', database=None,
def get_connection(hostname=None, protocol="xmlrpc", port='auto', database=None,
login=None, password=None, user_id=None):
A shortcut method to easily create a connection to a remote OpenERP server.
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