From cb738dfbaba6ed501230309e1a1e91f79621e2c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 13 Nov 2011 16:40:37 +0100 Subject: [PATCH] do not use type codes in search form --- tabellio/searchform/form.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tabellio/searchform/form.py b/tabellio/searchform/form.py index f7ad29f..41f137b 100644 --- a/tabellio/searchform/form.py +++ b/tabellio/searchform/form.py @@ -27,6 +27,7 @@ from plone.registry.interfaces import IRegistry from tabellio.config.interfaces import ITabellioSettings import tabellio.config.utils +from tabellio.documents.typenames import MAPPING class ListAuthorsView(BrowserView): @@ -157,7 +158,8 @@ def possible_document_types(context): if not doctype: continue doctype_id = doctype.encode('ascii', 'replace') - terms.append(SimpleVocabulary.createTerm(doctype_id, doctype_id, doctype)) + doctype_str = MAPPING.get(doctype, doctype) + terms.append(SimpleVocabulary.createTerm(doctype_id, doctype_id, doctype_str)) return SimpleVocabulary(terms) @grok.provider(IContextSourceBinder) @@ -169,7 +171,8 @@ def possible_dossier_types(context): if not dostype: continue dostype_id = dostype.encode('ascii', 'replace') - terms.append(SimpleVocabulary.createTerm(dostype_id, dostype_id, dostype)) + dostype_str = MAPPING.get(dostype, dostype) + terms.append(SimpleVocabulary.createTerm(dostype_id, dostype_id, dostype_str)) return SimpleVocabulary(terms) @grok.provider(IContextSourceBinder) @@ -181,7 +184,8 @@ def possible_question_types(context): if not questype: continue questype_id = questype.encode('ascii', 'replace') - terms.append(SimpleVocabulary.createTerm(questype_id, questype_id, questype)) + questype_str = MAPPING.get(questype, questype) + terms.append(SimpleVocabulary.createTerm(questype_id, questype_id, questype_str)) return SimpleVocabulary(terms) @grok.provider(IContextSourceBinder)