# HG changeset patch # User Thierry Florac # Date 1479199416 -3600 # Node ID 06e3617fe77d4ed94871206fa2e435ec6bf4ec9e # Parent 9491c1528b8052c38b0f73651922f5b0225c75fe Changed vocabulary declaration diff -r 9491c1528b80 -r 06e3617fe77d src/pyams_alchemy/engine.py --- a/src/pyams_alchemy/engine.py Mon Oct 24 16:59:33 2016 +0200 +++ b/src/pyams_alchemy/engine.py Tue Nov 15 09:43:36 2016 +0100 @@ -30,19 +30,18 @@ from pyams_alchemy.interfaces import REQUEST_SESSION_KEY, IAlchemyEngineUtility from pyams_utils.interfaces.site import IOptionalUtility from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent, IObjectRemovedEvent -from zope.schema.interfaces import IVocabularyFactory # import packages from persistent import Persistent from persistent.dict import PersistentDict from pyams_utils.registry import query_utility from pyams_utils.request import check_request, get_request_data, set_request_data +from pyams_utils.vocabulary import vocabulary_config from pyramid.events import subscriber from zope.componentvocabulary.vocabulary import UtilityVocabulary from zope.container.contained import Contained -from zope.interface import implementer, provider +from zope.interface import implementer from zope.schema.fieldproperty import FieldProperty -from zope.schema.vocabulary import getVocabularyRegistry from zope.sqlalchemy.datamanager import _SESSION_STATE, STATUS_READONLY, STATUS_ACTIVE, \ ZopeTransactionExtension, join_transaction @@ -245,11 +244,9 @@ return session -@provider(IVocabularyFactory) +@vocabulary_config(name='PyAMS SQLAlchemy engines') class EnginesVocabulary(UtilityVocabulary): """SQLAlchemy engines vocabulary""" interface = IAlchemyEngineUtility nameOnly = True - -getVocabularyRegistry().register('PyAMS SQLAlchemy engines', EnginesVocabulary)