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:
helmutm 2010-05-02 12:45:55 +00:00
parent e70bea85e5
commit 99a4e1ab2d

View file

@ -203,7 +203,7 @@ class ConceptView(BaseView):
cont = self.controller
if cont is None:
return
if (self.globalOptions('showParentsForAnonymous') or
if self.parents and (self.globalOptions('showParentsForAnonymous') or
not IUnauthenticatedPrincipal.providedBy(self.request.principal)):
cont.macros.register('portlet_right', 'parents', title=_(u'Parents'),
subMacro=concept_macros.macros['parents'],
@ -323,12 +323,15 @@ class ConceptView(BaseView):
return True
return False
@Lazy
def parents(self):
result = []
rels = sorted((pr for pr in self.context.getParentRelations()
if not self.isHidden(pr)),
key=(lambda x: x.first.title.lower()))
for r in rels:
yield self.childViewFactory(r, self.request)
result.append(self.childViewFactory(r, self.request))
return result
def resources(self):
rels = self.context.getResourceRelations()