[REF] netsvc: comments (kind of notes to self).
bzr revid: vmt@openerp.com-20110729145609-cbzlre0rsfxld3xq
This commit is contained in:
parent
40bde558c5
commit
ee12a9c9c5
|
@ -116,6 +116,8 @@ class ExportService(object):
|
||||||
def getService(cls,name):
|
def getService(cls,name):
|
||||||
return cls._services[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):
|
def dispatch(self, method, auth, params):
|
||||||
raise Exception("stub dispatch at %s" % self.__name)
|
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)
|
logger.log(channel, indent+line)
|
||||||
indent=indent_after
|
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:
|
class OpenERPDispatcher:
|
||||||
def log(self, title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""):
|
def log(self, title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""):
|
||||||
log(title, msg, channel=channel, depth=depth, fn=fn)
|
log(title, msg, channel=channel, depth=depth, fn=fn)
|
||||||
|
|
|
@ -213,7 +213,8 @@ class BaseHttpDaemon(threading.Thread, netsvc.Server):
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
# No need for these two classes: init_server() below can initialize correctly
|
||||||
|
# directly the BaseHttpDaemon class.
|
||||||
class HttpDaemon(BaseHttpDaemon):
|
class HttpDaemon(BaseHttpDaemon):
|
||||||
_RealProto = 'HTTP'
|
_RealProto = 'HTTP'
|
||||||
def __init__(self, interface, port):
|
def __init__(self, interface, port):
|
||||||
|
@ -270,6 +271,8 @@ def list_http_services(protocol=None):
|
||||||
raise Exception("Incorrect protocol or no http services")
|
raise Exception("Incorrect protocol or no http services")
|
||||||
|
|
||||||
import SimpleXMLRPCServer
|
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):
|
class XMLRPCRequestHandler(netsvc.OpenERPDispatcher,FixSendError,HttpLogHandler,SimpleXMLRPCServer.SimpleXMLRPCRequestHandler):
|
||||||
rpc_paths = []
|
rpc_paths = []
|
||||||
protocol_version = 'HTTP/1.1'
|
protocol_version = 'HTTP/1.1'
|
||||||
|
|
Loading…
Reference in New Issue