diff --git a/organize/browser/service.py b/organize/browser/service.py index 341899e..25f9c6f 100644 --- a/organize/browser/service.py +++ b/organize/browser/service.py @@ -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): diff --git a/organize/service.py b/organize/service.py index 8aad01f..1cf1805 100644 --- a/organize/service.py +++ b/organize/service.py @@ -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):