[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Service - ServiceManager.py:1.1.2.3 ServiceManagerBindingsView.py:1.1.2.2
Michael McLay
mclay@nist.gov
Sat, 9 Feb 2002 17:56:05 -0500
Update of /cvs-repository/Zope3/lib/python/Zope/App/Service
In directory cvs.zope.org:/tmp/cvs-serv17111/lib/python/Zope/App/Service
Modified Files:
Tag: Zope-3x-branch
ServiceManager.py ServiceManagerBindingsView.py
Log Message:
Added preliminary test for ServiceManagerBindings
Fixed minor bugs for ServicesManagerBindingsView and ServiceManager
Note: Known bug (test commented out) in ServiceManagerBindingsView -
It returns 'Acquired' when it should return 'None' in the bound variable of
the service map.
=== Zope3/lib/python/Zope/App/Service/ServiceManager.py 1.1.2.2 => 1.1.2.3 ===
if serviceName not in self.__defs.keys():
- raise UndefinedService(name)
+ raise UndefinedService(serviceName)
if not self.__defs[serviceName].isImplementedBy(serviceComponent):
- raise InvalidService(name, component, self.__defs[name])
+ raise InvalidService(serviceName, serviceComponentName, self.__defs[serviceName])
# Services are added to the Manager through the Folder interface
# self.setObject(name, component)
@@ -121,5 +121,5 @@
def getServiceDefinitions(self):
""" see IServiceManager Interface"""
- return self.__defs
+ return self.__defs.items()
=== Zope3/lib/python/Zope/App/Service/ServiceManagerBindingsView.py 1.1.2.1 => 1.1.2.2 ===
from Zope.PageTemplate.PageTemplateFile import PageTemplateFile
from Zope.Publisher.Browser.AttributePublisher import AttributePublisher
+from Zope.ComponentArchitecture.ContextDependent import ContextDependent
-class ServiceManagerBindingsView(AttributePublisher):
+class ServiceManagerBindingsView(AttributePublisher, ContextDependent):
index = PageTemplateFile('pt/services_bindings.pt')
def getServicesTable(self):
"""
"""
- allServices = self.getServiceDefinitions()
- localServices = self.objectItems()
+ context = self.getContext()
+ allServices = context.getServiceDefinitions()
+ localServices = context.objectItems()
services = []
for serviceName, service in allServices:
serviceMap={}
availableServices = []
acquiredOrNone = 'None'
- bound = self.getBoundService(serviceName)
+ bound = context.getBoundService(serviceName)
if bound is None:
# Because ServiceManager impliments the same interface as
# the global service manager, it needs to take an "object"
# which is the location to start the search for ServiceManagers
# if it's own lookup fails. By default, this is "self"
- acquired = self.getService(self, serviceName)
+ acquired = context.getService(self, serviceName)
if acquired:
acquiredOrNone = 'Acquired'
bound = acquiredOrNone