added adapter field 'textIndexAttributes' to specify attributes to include in text index

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2565 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-04-28 09:45:15 +00:00
parent 45efbd3c6f
commit 6fc13e3729
2 changed files with 8 additions and 4 deletions

View file

@ -89,6 +89,7 @@ class AdapterBase(object):
_adapterAttributes = ('context', '__parent__',) _adapterAttributes = ('context', '__parent__',)
_contextAttributes = list(IConcept) _contextAttributes = list(IConcept)
_noexportAttributes = () _noexportAttributes = ()
_textIndexAttributes = ()
def __init__(self, context): def __init__(self, context):
self.context = context self.context = context

View file

@ -42,7 +42,7 @@ from cybertools.typology.interfaces import IType, ITypeManager
from cybertools.util.jeep import Jeep from cybertools.util.jeep import Jeep
from loops.base import ParentInfo from loops.base import ParentInfo
from loops.common import AdapterBase from loops.common import adapted, AdapterBase
from loops.interfaces import IConcept, IConceptRelation, IConceptView from loops.interfaces import IConcept, IConceptRelation, IConceptView
from loops.interfaces import IConceptManager, IConceptManagerContained from loops.interfaces import IConceptManager, IConceptManagerContained
from loops.interfaces import ILoopsContained from loops.interfaces import ILoopsContained
@ -389,9 +389,12 @@ class IndexAttributes(object):
self.context = context self.context = context
def text(self): def text(self):
context = self.context ctx = self.context
# TODO: include attributes provided by concept type #return ' '.join((getName(ctx), ctx.title,))
return ' '.join((getName(context), context.title,)) actx = adapted(ctx)
indexAttrs = getattr(actx, '_textIndexAttributes', ())
return ' '.join([getName(ctx), ctx.title, ctx.description] +
[getattr(actx, attr, u'???') for attr in indexAttrs]).strip()
def title(self): def title(self):
context = self.context context = self.context