renamed client to instance; re-build schema/README.txt

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@1745 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2007-05-18 11:08:08 +00:00
parent da739765d8
commit 8ec1876315
2 changed files with 13 additions and 1 deletions

View file

@ -30,12 +30,22 @@ from cybertools.composer.interfaces import IInstance
class Instance(object): class Instance(object):
implements(IInstance) implements(IInstance)
template = None
templateKey = 'composer.template'
def __init__(self, context): def __init__(self, context):
self.context = context self.context = context
self.instances = [] self.instances = []
def setTemplate(self, template):
templates = getattr(self.context, '__templates__', {})
templates.setdefault(self.templateKey, template)
self.context.__templates__ = templates
def getTemplate(self):
templates = getattr(self.context, '__templates__', {})
return templates.get(self.templateKey, None)
template = property(getTemplate, setTemplate)
def applyTemplate(self, *args, **kw): def applyTemplate(self, *args, **kw):
raise ValueError('To be implemented by subclass') raise ValueError('To be implemented by subclass')

View file

@ -29,6 +29,8 @@ from cybertools.composer.instance import Instance
class Editor(Instance): class Editor(Instance):
templateKey = 'schema.editor'
def applyTemplate(self, data={}, *args, **kw): def applyTemplate(self, data={}, *args, **kw):
for c in self.template.components: for c in self.template.components:
# save data (if available) in context # save data (if available) in context