work in progress: layout managememnt

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2893 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-09-19 10:26:11 +00:00
parent 97cea0f183
commit 49102961e5
2 changed files with 7 additions and 16 deletions

View file

@ -49,17 +49,7 @@ class LayoutManager(object):
def getLayouts(self, key, instance):
region = self.regions.get(key)
if region is None:
return []
result = []
for layout in region.layouts:
if self.check(layout, instance):
result.append(layout)
return result
def check(self, layout, instance):
if instance is None or instance.checkLayout(layout):
return True
return instance.getLayouts(region)
class Layout(Template):
@ -90,6 +80,8 @@ class LayoutInstance(object):
def renderer(self):
return self.template.renderer
def checkLayout(self, layout):
return True
def getLayouts(self, region):
if region is None:
return []
return region.layouts

View file

@ -108,9 +108,8 @@ class ILayoutInstance(IInstance):
renderer = Attribute(u'An object responsible for rendering the layout.')
def checkLayout(layout):
""" Return True if the layout given is a valid sub-layout
for this instance.
def getLayouts(region):
""" Return a sequence of sub-layouts for the region given.
"""