src/pyams_content/shared/news/__init__.py
changeset 60 da1454d7d358
parent 17 eb468be7c127
child 114 7799437055f1
--- a/src/pyams_content/shared/news/__init__.py	Mon Oct 24 15:54:38 2016 +0200
+++ b/src/pyams_content/shared/news/__init__.py	Tue Nov 15 09:47:14 2016 +0100
@@ -24,18 +24,18 @@
 from pyams_content.shared.news.interfaces import INewsEvent, IWfNewsEvent, NEWS_CONTENT_TYPE, NEWS_CONTENT_NAME, \
     DISPLAY_FIRST_VERSION, DISPLAY_CURRENT_VERSION, VERSION_DISPLAY
 from pyams_workflow.interfaces import IWorkflowVersions, VersionError, IWorkflowPublicationInfo
-from zope.schema.interfaces import IVocabularyFactory
 
 # import packages
 from pyams_content.shared.common import SharedContent, WfSharedContent, register_content_type
 from pyams_utils.date import format_date
 from pyams_utils.request import check_request
-from zope.interface import implementer, provider
+from pyams_utils.vocabulary import vocabulary_config
+from zope.interface import implementer
 from zope.schema.fieldproperty import FieldProperty
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm, getVocabularyRegistry
+from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
 
 
-@provider(IVocabularyFactory)
+@vocabulary_config(name='PyAMS news publication date')
 class WfNewsDisplayedDateVocabulary(SimpleVocabulary):
     """Base news event vocabulary"""
 
@@ -64,8 +64,6 @@
         terms.append(SimpleTerm(DISPLAY_CURRENT_VERSION, title=current_version_label))
         super(WfNewsDisplayedDateVocabulary, self).__init__(terms)
 
-getVocabularyRegistry().register('PyAMS news publication date', WfNewsDisplayedDateVocabulary)
-
 
 @implementer(IWfNewsEvent, IParagraphContainerTarget, IThemesTarget, IExtFileContainerTarget, ILinkContainerTarget,
              IGalleryContainerTarget)