prepare for hiding concepts from parents portlet for certain roles
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3835 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
e70bea85e5
commit
99a4e1ab2d
1 changed files with 5 additions and 2 deletions
|
@ -203,7 +203,7 @@ class ConceptView(BaseView):
|
||||||
cont = self.controller
|
cont = self.controller
|
||||||
if cont is None:
|
if cont is None:
|
||||||
return
|
return
|
||||||
if (self.globalOptions('showParentsForAnonymous') or
|
if self.parents and (self.globalOptions('showParentsForAnonymous') or
|
||||||
not IUnauthenticatedPrincipal.providedBy(self.request.principal)):
|
not IUnauthenticatedPrincipal.providedBy(self.request.principal)):
|
||||||
cont.macros.register('portlet_right', 'parents', title=_(u'Parents'),
|
cont.macros.register('portlet_right', 'parents', title=_(u'Parents'),
|
||||||
subMacro=concept_macros.macros['parents'],
|
subMacro=concept_macros.macros['parents'],
|
||||||
|
@ -323,12 +323,15 @@ class ConceptView(BaseView):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@Lazy
|
||||||
def parents(self):
|
def parents(self):
|
||||||
|
result = []
|
||||||
rels = sorted((pr for pr in self.context.getParentRelations()
|
rels = sorted((pr for pr in self.context.getParentRelations()
|
||||||
if not self.isHidden(pr)),
|
if not self.isHidden(pr)),
|
||||||
key=(lambda x: x.first.title.lower()))
|
key=(lambda x: x.first.title.lower()))
|
||||||
for r in rels:
|
for r in rels:
|
||||||
yield self.childViewFactory(r, self.request)
|
result.append(self.childViewFactory(r, self.request))
|
||||||
|
return result
|
||||||
|
|
||||||
def resources(self):
|
def resources(self):
|
||||||
rels = self.context.getResourceRelations()
|
rels = self.context.getResourceRelations()
|
||||||
|
|
Loading…
Add table
Reference in a new issue