Changed vocabulary declaration
authorThierry Florac <thierry.florac@onf.fr>
Tue, 15 Nov 2016 10:36:29 +0100
changeset 163 b59216ef0d30
parent 162 78112f438733
child 164 cd734c4dcad9
Changed vocabulary declaration
src/pyams_skin/vocabulary.py
--- a/src/pyams_skin/vocabulary.py	Tue Oct 11 16:14:01 2016 +0200
+++ b/src/pyams_skin/vocabulary.py	Tue Nov 15 10:36:29 2016 +0100
@@ -18,16 +18,14 @@
 # import interfaces
 from pyams_skin.interfaces import ISkin
 from pyams_skin.layer import IPyAMSUserLayer
-from zope.schema.interfaces import IVocabularyFactory
 
 # import packages
 from pyams_utils.request import check_request
-from zope.interface import provider
+from pyams_utils.vocabulary import vocabulary_config
 from zope.componentvocabulary.vocabulary import UtilityVocabulary, UtilityTerm
-from zope.schema.vocabulary import getVocabularyRegistry
 
 
-@provider(IVocabularyFactory)
+@vocabulary_config(name='PyAMS skins')
 class SkinsVocabulary(UtilityVocabulary):
     "PyAMS skins vocabulary"""
 
@@ -42,10 +40,8 @@
                  for (name, util) in registry.getUtilitiesFor(self.interface)]
         self._terms = dict((title, UtilityTerm(name, title)) for name, title in utils)
 
-getVocabularyRegistry().register('PyAMS skins', SkinsVocabulary)
 
-
-@provider(IVocabularyFactory)
+@vocabulary_config(name='PyAMS user skins')
 class UserSkinsVocabulary(UtilityVocabulary):
     """PyAMS custom users skins vocabulary"""
 
@@ -60,5 +56,3 @@
                  for (name, util) in registry.getUtilitiesFor(self.interface)
                  if issubclass(util.layer, IPyAMSUserLayer)]
         self._terms = dict((title, UtilityTerm(name, title)) for name, title in utils)
-
-getVocabularyRegistry().register('PyAMS user skins', UserSkinsVocabulary)