[IMP] rename Service.service_exist to Service.exits (classmethod)

bzr revid: chs@tinyerp.com-20100129101712-ok7fd5y0hnow5fds
This commit is contained in:
Christophe Simonis 2010-01-29 11:17:12 +01:00
parent 75865c8161
commit cb307f9213
3 changed files with 9 additions and 8 deletions

View File

@ -38,8 +38,8 @@ import xmlrpclib
import release
class Service(object):
""" Base class for *Local* services
""" Base class for *Local* services
Functionality here is trusted, no authentication.
"""
_services = {}
@ -52,8 +52,9 @@ class Service(object):
raise Exception("No group for local services")
#GROUPS.setdefault(name, {})[self.__name] = self
def service_exist(self,name):
return Service._services.has_key(name)
@classmethod
def exists(cls, name):
return name in cls._services
def exportMethod(self, method):
if callable(method):

View File

@ -46,7 +46,7 @@ def toxml(val):
class report_int(netsvc.Service):
def __init__(self, name, audience='*'):
assert not self.service_exist(name), 'The report "%s" already exist!' % name
assert not self.exists(name), 'The report "%s" already exists!' % name
super(report_int, self).__init__(name, audience)
if name[0:7]<>'report.':
raise Exception, 'ConceptionError, bad report name, should start with "report."'

View File

@ -41,13 +41,13 @@ class except_wizard(Exception):
class interface(netsvc.Service):
states = {}
def __init__(self, name):
assert not self.service_exist('wizard.'+name), 'The wizard "%s" already exists!'%name
assert not self.exists('wizard.'+name), 'The wizard "%s" already exists!' % (name,)
super(interface, self).__init__('wizard.'+name)
self.exportMethod(self.execute)
self.wiz_name = name
def translate_view(self, cr, node, state, lang):
if node.get('string'):
trans = translate(cr, self.wiz_name+','+state, 'wizard_view', lang, node.get('string').encode('utf8'))