From 6fc13e3729b03c971ba500e9ed3e74fc10a9fd59 Mon Sep 17 00:00:00 2001 From: helmutm Date: Mon, 28 Apr 2008 09:45:15 +0000 Subject: [PATCH] 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 --- common.py | 1 + concept.py | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/common.py b/common.py index 3229b09..b32b9e7 100644 --- a/common.py +++ b/common.py @@ -89,6 +89,7 @@ class AdapterBase(object): _adapterAttributes = ('context', '__parent__',) _contextAttributes = list(IConcept) _noexportAttributes = () + _textIndexAttributes = () def __init__(self, context): self.context = context diff --git a/concept.py b/concept.py index e4f5817..753edc8 100644 --- a/concept.py +++ b/concept.py @@ -42,7 +42,7 @@ from cybertools.typology.interfaces import IType, ITypeManager from cybertools.util.jeep import Jeep 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 IConceptManager, IConceptManagerContained from loops.interfaces import ILoopsContained @@ -389,9 +389,12 @@ class IndexAttributes(object): self.context = context def text(self): - context = self.context - # TODO: include attributes provided by concept type - return ' '.join((getName(context), context.title,)) + ctx = self.context + #return ' '.join((getName(ctx), ctx.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): context = self.context