Commit 6eeca8d1 authored by Hanno Schlichting's avatar Hanno Schlichting

Factor out zope.schema.vocabulary support

parent 627b5f22
...@@ -16,6 +16,7 @@ from zope.component import getUtility ...@@ -16,6 +16,7 @@ from zope.component import getUtility
from zope.interface import implements from zope.interface import implements
from zope.schema.interfaces import IVocabularyFactory from zope.schema.interfaces import IVocabularyFactory
from zope.schema.interfaces import IVocabularyRegistry from zope.schema.interfaces import IVocabularyRegistry
from zope.schema.vocabulary import setVocabularyRegistry
class Zope2VocabularyRegistry(object): class Zope2VocabularyRegistry(object):
...@@ -30,3 +31,7 @@ class Zope2VocabularyRegistry(object): ...@@ -30,3 +31,7 @@ class Zope2VocabularyRegistry(object):
""" """
factory = getUtility(IVocabularyFactory, name) factory = getUtility(IVocabularyFactory, name)
return factory(context) return factory(context)
def configure_vocabulary_registry():
setVocabularyRegistry(Zope2VocabularyRegistry())
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
from zope.component import queryMultiAdapter from zope.component import queryMultiAdapter
from zope.event import notify from zope.event import notify
from zope.processlifetime import DatabaseOpened from zope.processlifetime import DatabaseOpened
from zope.schema.vocabulary import setVocabularyRegistry
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import noSecurityManager from AccessControl.SecurityManagement import noSecurityManager
...@@ -110,8 +109,8 @@ def startup(): ...@@ -110,8 +109,8 @@ def startup():
load_site() load_site()
# Set up Zope2 specific vocabulary registry # Set up Zope2 specific vocabulary registry
from .schema import Zope2VocabularyRegistry from .schema import configure_vocabulary_registry
setVocabularyRegistry(Zope2VocabularyRegistry()) configure_vocabulary_registry()
# Set up the "app" object that automagically opens # Set up the "app" object that automagically opens
# connections # connections
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment