use randomname.generateName() for client names
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@1930 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
3330529cbb
commit
6bd2c94f05
2 changed files with 17 additions and 9 deletions
|
@ -30,6 +30,13 @@ from cybertools.composer.schema.browser.common import BaseView
|
|||
from cybertools.composer.schema.interfaces import IClientFactory
|
||||
|
||||
|
||||
class ServiceManagerView(object):
|
||||
|
||||
def __init__(self, context, request):
|
||||
self.context = context
|
||||
self.request = request
|
||||
|
||||
|
||||
class ServiceView(object):
|
||||
|
||||
def __init__(self, context, request):
|
||||
|
|
|
@ -28,9 +28,10 @@ from zope.cachedescriptors.property import Lazy
|
|||
from zope.component import adapts
|
||||
from zope.interface import implements
|
||||
from cybertools.composer.interfaces import IInstance
|
||||
from cybertools.util.jeep import Jeep
|
||||
|
||||
from cybertools.composer.schema.interfaces import IClientManager, IClient
|
||||
from cybertools.util.jeep import Jeep
|
||||
from cybertools.util.randomname import generateName
|
||||
|
||||
from cybertools.organize.interfaces import IServiceManager
|
||||
from cybertools.organize.interfaces import IService, IScheduledService
|
||||
from cybertools.organize.interfaces import IRegistration, IRegistrationTemplate
|
||||
|
@ -48,7 +49,7 @@ class ServiceManager(object):
|
|||
services = None
|
||||
clients = None
|
||||
|
||||
clientNum = 0
|
||||
#clientNum = 0
|
||||
|
||||
def __init__(self):
|
||||
if self.servicesFactory is not None:
|
||||
|
@ -76,8 +77,12 @@ class ServiceManager(object):
|
|||
return name
|
||||
|
||||
def generateClientName(self, client):
|
||||
self.clientNum += 1
|
||||
return '%05i' % self.clientNum
|
||||
return generateName(self.checkClientName)
|
||||
#self.clientNum += 1
|
||||
#return '%05i' % self.clientNum
|
||||
|
||||
def checkClientName(self, name):
|
||||
return not name in self.getClients()
|
||||
|
||||
|
||||
class Service(object):
|
||||
|
@ -185,10 +190,6 @@ class ClientRegistrations(object):
|
|||
|
||||
def getRegistrations(self):
|
||||
return getattr(self.context, self.registrationsAttributeName, [])
|
||||
#for service in self.template.getServices():
|
||||
# for reg in service.registrations.values():
|
||||
# if self.context == reg.client:
|
||||
# yield reg
|
||||
|
||||
|
||||
# event handlers
|
||||
|
|
Loading…
Add table
Reference in a new issue