[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Service - ServiceManager.py:1.1.2.5
Steve Alexander
steve@cat-box.net
Wed, 20 Feb 2002 03:47:28 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Service
In directory cvs.zope.org:/tmp/cvs-serv19792/lib/python/Zope/App/Service
Modified Files:
Tag: Zope-3x-branch
ServiceManager.py
Log Message:
changed mixed tabs/spaces indentation to spaces only indentation.
=== Zope3/lib/python/Zope/App/Service/ServiceManager.py 1.1.2.4 => 1.1.2.5 ===
def __init__(self):
self.__defs = {}
- self.__bindings = {}
+ self.__bindings = {}
Folder.__init__(self)
def defineService(self, name, interface):
@@ -57,22 +57,22 @@
self.__defs[name] = interface
def getServiceDefinitions(self):
- serviceDefs = self__defs.items()
- # Get the services defined above us
- parentSM = self._findParentServiceManager()
- if parentSM is not None:
- serviceDefs = serviceDefs + parentSM.getServiceDefinitions()
- else:
- serviceDefs = serviceDefs + getServiceDefinitions()
-
- return serviceDefs
+ serviceDefs = self__defs.items()
+ # Get the services defined above us
+ parentSM = self._findParentServiceManager()
+ if parentSM is not None:
+ serviceDefs = serviceDefs + parentSM.getServiceDefinitions()
+ else:
+ serviceDefs = serviceDefs + getServiceDefinitions()
+
+ return serviceDefs
def _findParentServiceManager(self):
- parent = getinnercontext(self)
+ parent = getinnercontext(self)
- if IServiceManagerContainer.isImplementedBy(parent):
- sm = parent.getServiceManager()
- return sm
+ if IServiceManagerContainer.isImplementedBy(parent):
+ sm = parent.getServiceManager()
+ return sm
def getService(self, object, name):
""" see IServiceManager Interface"""
@@ -82,15 +82,15 @@
if service:
return self.getObject(service)
- object = self._findParentServiceManager()
+ object = self._findParentServiceManager()
while object is not None:
- # object = getinnercontext(object)
- #
- # if IServiceManagerContainer.isImplementedBy(object):
- # sm = object.getServiceManager()
- # if sm:
- # return sm.getService(object, name)
- return sm.getService(object, name)
+ # object = getinnercontext(object)
+ #
+ # if IServiceManagerContainer.isImplementedBy(object):
+ # sm = object.getServiceManager()
+ # if sm:
+ # return sm.getService(object, name)
+ return sm.getService(object, name)
# fallback to the ComponentArchitecture Service Manager
# XXX when this called the original object might no longer be
@@ -98,17 +98,17 @@
return getService(object, name)
def getBoundService(self, name):
- """ see IServiceManager Interface"""
+ """ see IServiceManager Interface"""
- return self.__bindings.get(name)
+ return self.__bindings.get(name)
def bindService(self, serviceName, serviceComponentName):
""" see IServiceManager Interface"""
- # This could raise a KeyError if we don't have this component
- serviceComponent = self.getObject(serviceComponentName)
+ # This could raise a KeyError if we don't have this component
+ serviceComponent = self.getObject(serviceComponentName)
- if serviceName not in self.__defs.keys():
+ if serviceName not in self.__defs.keys():
raise UndefinedService(serviceName)
if not self.__defs[serviceName].isImplementedBy(serviceComponent):
@@ -116,11 +116,11 @@
self.__defs[serviceName])
# Services are added to the Manager through the Folder interface
- # self.setObject(name, component)
- self.__bindings[serviceName] = serviceComponentName
+ # self.setObject(name, component)
+ self.__bindings[serviceName] = serviceComponentName
def getServiceDefinitions(self):
- """ see IServiceManager Interface"""
+ """ see IServiceManager Interface"""
- return self.__defs.items()
+ return self.__defs.items()