--- a/src/pyams_thesaurus/loader/__init__.py Tue Oct 11 16:15:05 2016 +0200
+++ b/src/pyams_thesaurus/loader/__init__.py Tue Nov 15 10:41:35 2016 +0100
@@ -22,7 +22,6 @@
IThesaurusExporter
from pyams_thesaurus.interfaces.term import IThesaurusLoaderTerm
from pyams_thesaurus.interfaces.thesaurus import IThesaurusDescription
-from zope.schema.interfaces import IVocabularyFactory
# import packages
from BTrees.OOBTree import OOBTree
@@ -30,10 +29,10 @@
from pyams_thesaurus.thesaurus import ThesaurusTermsContainer, Thesaurus
from pyams_utils.request import query_request
from pyams_utils.unicode import translate_string
+from pyams_utils.vocabulary import vocabulary_config
from zope.componentvocabulary.vocabulary import UtilityVocabulary
-from zope.interface import implementer, provider, alsoProvides, noLongerProvides
+from zope.interface import implementer, alsoProvides, noLongerProvides
from zope.schema.fieldproperty import FieldProperty
-from zope.schema.vocabulary import getVocabularyRegistry
#
@@ -172,15 +171,13 @@
return Thesaurus(description=description, terms=store)
-@provider(IVocabularyFactory)
+@vocabulary_config(name='PyAMS thesaurus loaders')
class ThesaurusLoadersVocabulary(UtilityVocabulary):
"""Thesaurus loaders vocabulary"""
interface = IThesaurusLoader
nameOnly = True
-getVocabularyRegistry().register('PyAMS thesaurus loaders', ThesaurusLoadersVocabulary)
-
#
# Thesaurus exporters classes
@@ -229,11 +226,9 @@
return output
-@provider(IVocabularyFactory)
+@vocabulary_config(name='PyAMS thesaurus exporters')
class ThesaurusExportersVocabulary(UtilityVocabulary):
"""Thesaurus exporters vocabulary"""
interface = IThesaurusExporter
nameOnly = True
-
-getVocabularyRegistry().register('PyAMS thesaurus exporters', ThesaurusExportersVocabulary)