Changed vocabulary declaration
authorThierry Florac <thierry.florac@onf.fr>
Tue, 15 Nov 2016 10:27:19 +0100
changeset 30 6be392beb0a5
parent 29 a456add728e3
child 31 4b0e0e3c1e59
Changed vocabulary declaration
src/pyams_scheduler/trigger.py
--- a/src/pyams_scheduler/trigger.py	Tue Oct 11 16:07:46 2016 +0200
+++ b/src/pyams_scheduler/trigger.py	Tue Nov 15 10:27:19 2016 +0100
@@ -19,7 +19,6 @@
 from pyams_scheduler.interfaces import ITaskSchedulingMode, ICronTaskScheduling, ICronTask, SCHEDULER_TASK_CRON_INFO, \
     IDateTaskScheduling, IDateTask, ILoopTaskScheduling, SCHEDULER_TASK_DATE_INFO, ILoopTask, SCHEDULER_TASK_LOOP_INFO
 from zope.annotation.interfaces import IAnnotations
-from zope.schema.interfaces import IVocabularyFactory
 
 # import packages
 from apscheduler.triggers.cron import CronTrigger
@@ -30,23 +29,21 @@
 from pyams_utils.date import date_to_datetime
 from pyams_utils.registry import utility_config
 from pyams_utils.timezone import tztime
+from pyams_utils.vocabulary import vocabulary_config
 from zope.componentvocabulary.vocabulary import UtilityVocabulary
-from zope.interface import implementer, provider
+from zope.interface import implementer
 from zope.schema.fieldproperty import FieldProperty
-from zope.schema.vocabulary import getVocabularyRegistry
 
 from pyams_scheduler import _
 
 
-@provider(IVocabularyFactory)
+@vocabulary_config(name='PyAMS scheduling modes')
 class SchedulingModesVocabulary(UtilityVocabulary):
     """Scheduling modes vocabulary"""
 
     interface = ITaskSchedulingMode
     nameOnly = True
 
-getVocabularyRegistry().register('PyAMS scheduling modes', SchedulingModesVocabulary)
-
 
 #
 # Cron-style scheduling mode