[REF] service: killed the ExportService concept.

bzr revid: vmt@openerp.com-20130130165812-0hzfnfudi8im0usb
This commit is contained in:
Vo Minh Thu 2013-01-30 17:58:12 +01:00
parent 4aacad4abf
commit 2c2b6d9506
2 changed files with 11 additions and 34 deletions

View File

@ -96,38 +96,6 @@ def LocalService(name):
return Service._services[name]
class ExportService(object):
""" Proxy for exported services.
Note that this class has no direct proxy, capable of calling
eservice.method(). Rather, the proxy should call
dispatch(method, params)
"""
_services = {}
def __init__(self, name):
ExportService._services[name] = self
self.__name = name
_logger.debug("Registered an exported service: %s" % name)
@classmethod
def getService(cls,name):
if name == 'object':
return openerp.service.model
if name == 'db':
return openerp.service.db
if name == 'common':
return openerp.service.common
if name == 'report':
return openerp.service.report
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, params):
raise Exception("stub dispatch at %s" % self.__name)
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE, _NOTHING, DEFAULT = range(10)
#The background is set with 40 plus the number of the color, and the foreground with 30
#These are the sequences need to get colored ouput
@ -292,7 +260,16 @@ def dispatch_rpc(service_name, method, params):
threading.current_thread().uid = None
threading.current_thread().dbname = None
result = ExportService.getService(service_name).dispatch(method, params)
service = None
if service_name == 'object':
service = openerp.service.model
if service_name == 'db':
service = openerp.service.db
if service_name == 'common':
service = openerp.service.common
if service_name == 'report':
service = openerp.service.report
result = service.dispatch(method, params)
if rpc_request_flag or rpc_response_flag:
end_time = time.time()

View File

@ -361,7 +361,7 @@ class WorkerCron(Worker):
if config['db_name']:
db_names = config['db_name'].split(',')
else:
db_names = openerp.netsvc.ExportService._services['db'].exp_list(True)
db_names = openerp.service.db.exp_list(True)
for db_name in db_names:
if rpc_request_flag:
start_time = time.time()