do not use layouts within default root node if there are more specific layouts
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3750 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
ba04663fec
commit
d76c881c17
1 changed files with 17 additions and 5 deletions
|
@ -108,8 +108,10 @@ class TargetLayoutInstance(NodeLayoutInstance):
|
||||||
pageName = self.viewAnnotations.get('pageName', u'')
|
pageName = self.viewAnnotations.get('pageName', u'')
|
||||||
obj = self.target.context
|
obj = self.target.context
|
||||||
tp = obj.getType()
|
tp = obj.getType()
|
||||||
found = False
|
#found = False
|
||||||
currentRoot = self.context.getMenu()
|
currentRoot = self.context.getMenu()
|
||||||
|
specifics = []
|
||||||
|
defaults = []
|
||||||
for n in obj.getClients() + tp.getClients():
|
for n in obj.getClients() + tp.getClients():
|
||||||
if not ILayoutNode.providedBy(n):
|
if not ILayoutNode.providedBy(n):
|
||||||
continue
|
continue
|
||||||
|
@ -117,15 +119,25 @@ class TargetLayoutInstance(NodeLayoutInstance):
|
||||||
if pageName != (n.pageName or '').strip():
|
if pageName != (n.pageName or '').strip():
|
||||||
continue
|
continue
|
||||||
layoutRoot = n.getMenu()
|
layoutRoot = n.getMenu()
|
||||||
if getName(layoutRoot) != 'default' and layoutRoot != currentRoot:
|
rootName = getName(layoutRoot)
|
||||||
|
if rootName != 'default' and layoutRoot != currentRoot:
|
||||||
continue
|
continue
|
||||||
layout = region.layouts[n.viewName]
|
layout = region.layouts[n.viewName]
|
||||||
li = component.getAdapter(n, ILayoutInstance,
|
li = component.getAdapter(n, ILayoutInstance,
|
||||||
name=layout.instanceName)
|
name=layout.instanceName)
|
||||||
li.template = layout
|
li.template = layout
|
||||||
result.append(li)
|
#result.append(li)
|
||||||
found = True
|
#found = True
|
||||||
if not found:
|
if rootName == 'default':
|
||||||
|
defaults.append(li)
|
||||||
|
else:
|
||||||
|
specifics.append(li)
|
||||||
|
if specifics:
|
||||||
|
result.extend(specifics)
|
||||||
|
elif defaults:
|
||||||
|
result.extend(defaults)
|
||||||
|
#if not found:
|
||||||
|
else:
|
||||||
if self.template.defaultSublayout is None:
|
if self.template.defaultSublayout is None:
|
||||||
logger.warn('No target layout found: pageName = %r, target = %r'
|
logger.warn('No target layout found: pageName = %r, target = %r'
|
||||||
% (pageName, getName(obj)))
|
% (pageName, getName(obj)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue