use special property 'favTitle' for favorites portlet

This commit is contained in:
Helmut Merz 2016-12-19 14:45:09 +01:00
parent f9ba9d2115
commit 30c13d57d7
4 changed files with 19 additions and 7 deletions

View file

@ -170,6 +170,10 @@ class AdapterBase(object):
def uid(self):
return util.getUidForObject(self.context)
@Lazy
def favTitle(self):
return self.title
def getChildren(self, predicates=None):
for c in self.context.getChildren(predicates):
yield adapted(c, self.languageInfo)

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -185,6 +185,10 @@ class Concept(Contained, Persistent):
def getLongTitle(self):
return self.title
@property
def favTitle(self):
return self.title
# concept relations
def getClients(self, relationships=None):

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -18,8 +18,6 @@
"""
A view (to be used by listings, portlets, ...) for favorites.
$Id$
"""
from zope import component
@ -28,6 +26,7 @@ from zope.cachedescriptors.property import Lazy
from cybertools.browser.configurator import ViewConfigurator, MacroViewProperty
from loops.browser.node import NodeView
from loops.common import adapted
from loops.organize.party import getPersonForUser
from loops.organize.personal.interfaces import IFavorites
from loops import util
@ -61,10 +60,11 @@ class FavoriteView(NodeView):
for uid in self.favorites.list(self.person):
obj = util.getObjectForUid(uid)
if obj is not None:
adobj = adapted(obj)
yield dict(url=self.getUrlForTarget(obj),
uid=uid,
title=obj.title,
description=obj.description,
title=adobj.favTitle,
description=adobj.description,
object=obj)
def add(self):

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -173,6 +173,10 @@ class Resource(Image, Contained):
def getConceptManager(self):
return self.getLoopsRoot().getConceptManager()
@property
def favTitle(self):
return self.title
def getAllParents(self, collectGrants=False, ignoreTypes=False):
result = Jeep()
for rel in self.getConceptRelations():