provide findRegistrationTemplate() method for ServiceManagerView

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@1934 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2007-08-19 14:42:32 +00:00
parent c0c772ff30
commit a9b3f303fa
2 changed files with 12 additions and 6 deletions

View file

@ -25,7 +25,7 @@ $Id$
from zope import component
from zope.cachedescriptors.property import Lazy
from cybertools.organize.interfaces import IClientRegistrations
from cybertools.organize.interfaces import IClientRegistrations, IRegistrationTemplate
from cybertools.composer.schema.browser.common import BaseView
from cybertools.composer.schema.interfaces import IClientFactory
@ -36,6 +36,16 @@ class ServiceManagerView(object):
self.context = context
self.request = request
def findRegistrationTemplate(self, service):
""" Find a registration template that provides the registration
for the service given.
"""
for tpl in self.context.getClientSchemas():
if IRegistrationTemplate.providedBy(tpl):
# TODO: check that service is really provided by this template
return tpl
return None
class ServiceView(object):

View file

@ -49,8 +49,6 @@ class ServiceManager(object):
services = None
clients = None
#clientNum = 0
def __init__(self):
if self.servicesFactory is not None:
self.services = self.servicesFactory()
@ -78,11 +76,9 @@ class ServiceManager(object):
def generateClientName(self, client):
return generateName(self.checkClientName)
#self.clientNum += 1
#return '%05i' % self.clientNum
def checkClientName(self, name):
return not name in self.getClients()
return name not in self.getClients()
class Service(object):