From 786386060d5a630ac9b16388783bb864c94f31af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 18 Jul 2012 14:02:20 +0200 Subject: [PATCH] add mailHandledByTxt catalog column --- themis/search/indexer.py | 18 ++++++++++++++++++ themis/search/profiles/default/catalog.xml | 1 + 2 files changed, 19 insertions(+) diff --git a/themis/search/indexer.py b/themis/search/indexer.py index abdb934..5c5b1ce 100644 --- a/themis/search/indexer.py +++ b/themis/search/indexer.py @@ -333,3 +333,21 @@ def statusTitleIndexer(obj): return workflow.states[current_state].title grok.global_adapter(statusTitleIndexer, name='statusTitle') + +@indexer(plone.dexterity.interfaces.IDexterityItem) +def mailHandledByTxtIndexer(obj): + if obj.portal_type not in ('courrier_entrant', 'courrier_sortant'): + return None + values = [] + for attr in ('traite__par',): + if not hasattr(obj, attr): + continue + if getattr(obj, attr): + for person in getattr(obj, attr): + values.append(person) + if values: + return ', '.join(values) + else: + return None + +grok.global_adapter(mailHandledByTxtIndexer, name="mailHandledByTxt") diff --git a/themis/search/profiles/default/catalog.xml b/themis/search/profiles/default/catalog.xml index f06c687..6cb1b90 100644 --- a/themis/search/profiles/default/catalog.xml +++ b/themis/search/profiles/default/catalog.xml @@ -67,6 +67,7 @@ +