From 16b670a47ca04c95edf42687526285b99ffb2498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Sun, 14 Apr 2013 16:56:28 +0200 Subject: [PATCH] fix simple thesaurus vocabulary --- src/collective/dms/thesaurus/vocabulary.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/collective/dms/thesaurus/vocabulary.py b/src/collective/dms/thesaurus/vocabulary.py index eb61b68..279b59c 100644 --- a/src/collective/dms/thesaurus/vocabulary.py +++ b/src/collective/dms/thesaurus/vocabulary.py @@ -24,12 +24,10 @@ class SimpleThesaurusSource(object): grok.implements(IVocabularyFactory) def __call__(self, context): - catalog = getToolByName(context, 'portal_catalog') - thesaurus = catalog(portal_type='dmsthesaurus') - if not len(thesaurus): - raise NoThesaurusFound # build vocab from first thesaurus returned by catalog - thesaurus_path = '/'.join(thesaurus[0].getPath()) + thesaurus = utils.get_thesaurus_object(context) + thesaurus_path = '/'.join(thesaurus.getPhysicalPath()) + catalog = getToolByName(context, 'portal_catalog') results = catalog(portal_type='dmskeyword', path={'query': thesaurus_path,'depth': 1}) keywords = [x.getObject() for x in results]