suppress favorites portlet if no 'favorites' storage present
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2455 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
1db870308c
commit
3524ab83be
2 changed files with 9 additions and 2 deletions
2
base.py
2
base.py
|
@ -72,7 +72,7 @@ class Loops(Folder):
|
||||||
return self['views']
|
return self['views']
|
||||||
|
|
||||||
def getRecordManager(self):
|
def getRecordManager(self):
|
||||||
return self['records']
|
return self.get('records')
|
||||||
|
|
||||||
def getLoopsUri(self, obj):
|
def getLoopsUri(self, obj):
|
||||||
return str(loopsPrefix + getPath(obj)[len(getPath(self)):])
|
return str(loopsPrefix + getPath(obj)[len(getPath(self)):])
|
||||||
|
|
|
@ -44,9 +44,16 @@ class PortletConfigurator(ViewConfigurator):
|
||||||
self.context = context
|
self.context = context
|
||||||
self.request = request
|
self.request = request
|
||||||
|
|
||||||
|
def hasFavorites(self):
|
||||||
|
records = self.context.getLoopsRoot().getRecordManager()
|
||||||
|
if records is not None:
|
||||||
|
return 'favorites' in records
|
||||||
|
return False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def viewProperties(self):
|
def viewProperties(self):
|
||||||
if getPersonForUser(self.context, self.request) is None:
|
if (not self.hasFavorites()
|
||||||
|
or getPersonForUser(self.context, self.request) is None):
|
||||||
#if IUnauthenticatedPrincipal.providedBy(self.request.principal):
|
#if IUnauthenticatedPrincipal.providedBy(self.request.principal):
|
||||||
return []
|
return []
|
||||||
favorites = MacroViewProperty(self.context, self.request)
|
favorites = MacroViewProperty(self.context, self.request)
|
||||||
|
|
Loading…
Add table
Reference in a new issue