src/pyams_security/plugin/group.py
changeset 72 6dd8bc7bb7b5
parent 45 4d5db00d12b9
--- a/src/pyams_security/plugin/group.py	Tue Oct 11 16:09:19 2016 +0200
+++ b/src/pyams_security/plugin/group.py	Tue Nov 15 10:34:41 2016 +0100
@@ -21,7 +21,6 @@
 from pyams_security.interfaces import IGroupsFolderPlugin, ILocalGroup, IPrincipalsAddedToGroupEvent, \
     IPrincipalsRemovedFromGroupEvent, PrincipalsAddedToGroupEvent, PrincipalsRemovedFromGroupEvent, ISecurityManager
 from zope.lifecycleevent.interfaces import IObjectAddedEvent
-from zope.schema.interfaces import IVocabularyFactory
 
 # import packages
 from BTrees import OOBTree
@@ -29,12 +28,13 @@
 from pyams_security.principal import PrincipalInfo
 from pyams_utils.registry import query_utility
 from pyams_utils.request import check_request
+from pyams_utils.vocabulary import vocabulary_config
 from pyramid.events import subscriber
 from zope.container.contained import Contained
 from zope.container.folder import Folder
-from zope.interface import implementer, provider
+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
 
 
 @implementer(ILocalGroup)
@@ -68,7 +68,7 @@
                 registry.notify(PrincipalsRemovedFromGroupEvent(self, removed))
 
 
-@provider(IVocabularyFactory)
+@vocabulary_config(name='PyAMS local groups')
 class LocalGroupsVocabulary(SimpleVocabulary):
     """'PyAMS local groups vocabulary"""
 
@@ -84,8 +84,6 @@
                                                 title=group.title))
         super(LocalGroupsVocabulary, self).__init__(terms)
 
-getVocabularyRegistry().register('PyAMS local groups', LocalGroupsVocabulary)
-
 
 @implementer(IGroupsFolderPlugin)
 class GroupsFolder(Folder):