diff --git a/openerp/netsvc.py b/openerp/netsvc.py index f3c13535d6f..6125f2218b3 100644 --- a/openerp/netsvc.py +++ b/openerp/netsvc.py @@ -116,6 +116,8 @@ class ExportService(object): def getService(cls,name): return cls._services[name] + # Dispatch a RPC call w.r.t. the method name. The dispatching + # w.r.t. the service (this class) is done by OpenERPDispatcher. def dispatch(self, method, auth, params): raise Exception("stub dispatch at %s" % self.__name) @@ -397,6 +399,11 @@ def log(title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""): logger.log(channel, indent+line) indent=indent_after +# This class is used to dispatch a RPC to a service. So it is used +# for both XMLRPC (with a SimpleXMLRPCRequestHandler), and NETRPC. +# The service (ExportService) will then dispatch on the method name. +# This can be re-written as a single function +# def dispatch(self, service_name, method, params, auth_provider). class OpenERPDispatcher: def log(self, title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""): log(title, msg, channel=channel, depth=depth, fn=fn) diff --git a/openerp/service/http_server.py b/openerp/service/http_server.py index 61713e9f2dd..d22d32aabeb 100644 --- a/openerp/service/http_server.py +++ b/openerp/service/http_server.py @@ -213,7 +213,8 @@ class BaseHttpDaemon(threading.Thread, netsvc.Server): return ret - +# No need for these two classes: init_server() below can initialize correctly +# directly the BaseHttpDaemon class. class HttpDaemon(BaseHttpDaemon): _RealProto = 'HTTP' def __init__(self, interface, port): @@ -270,6 +271,8 @@ def list_http_services(protocol=None): raise Exception("Incorrect protocol or no http services") import SimpleXMLRPCServer +# Basically, this class extends SimpleXMLRPCRequestHandler to use +# OpenERPDispatcher as the dispatcher (to select the correct ExportService). class XMLRPCRequestHandler(netsvc.OpenERPDispatcher,FixSendError,HttpLogHandler,SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): rpc_paths = [] protocol_version = 'HTTP/1.1'