src/pyams_portal/portlet.py
changeset 20 c3f7c8290792
parent 16 ea990f1f72d2
child 30 1e3f8a25ab06
--- a/src/pyams_portal/portlet.py	Tue Nov 15 10:24:09 2016 +0100
+++ b/src/pyams_portal/portlet.py	Tue Nov 15 10:24:40 2016 +0100
@@ -22,7 +22,6 @@
 # import interfaces
 from pyams_portal.interfaces import IPortlet, IPortletSettings, IPortletConfiguration, IPortletPreviewer, \
     IPortletRenderer, IPortalPortletsConfiguration, IPortalTemplate, IPortalContext, IPortalPage
-from zope.schema.interfaces import IVocabularyFactory
 from zope.traversing.interfaces import ITraversable
 
 # import packages
@@ -30,16 +29,17 @@
 from persistent.mapping import PersistentMapping
 from pyams_utils.adapter import adapter_config, ContextAdapter
 from pyams_utils.request import check_request
+from pyams_utils.vocabulary import vocabulary_config
 from pyams_viewlet.viewlet import ContentProvider
 from pyramid.exceptions import ConfigurationError
 from pyramid.threadlocal import get_current_registry
 from zope.container.contained import Contained
 from zope.copy import clone
-from zope.interface import implementer, provider
+from zope.interface import implementer
 from zope.lifecycleevent import ObjectCreatedEvent
 from zope.location import locate
 from zope.schema.fieldproperty import FieldProperty
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm, getVocabularyRegistry
+from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
 
 
 #
@@ -105,7 +105,7 @@
         return wrapped
 
 
-@provider(IVocabularyFactory)
+@vocabulary_config(name='PyAMS portal portlets')
 class PortletVocabulary(SimpleVocabulary):
     """Portlet vocabulary"""
 
@@ -117,8 +117,6 @@
                  for name, util in sorted(utils, key=lambda x: translate(x[1].label))]
         super(PortletVocabulary, self).__init__(terms)
 
-getVocabularyRegistry().register('PyAMS portal portlets', PortletVocabulary)
-
 
 #
 # Portlets renderers