--- a/src/pyams_utils/zodb.py Wed Jul 22 17:26:41 2015 +0200
+++ b/src/pyams_utils/zodb.py Thu Jul 23 17:26:22 2015 +0200
@@ -9,6 +9,7 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
+from pyams_utils.registry import get_utilities_for
__docformat__ = 'restructuredtext'
@@ -37,7 +38,7 @@
from zope.interface import implementer, provider
from zope.schema import getFieldNames
from zope.schema.fieldproperty import FieldProperty
-from zope.schema.vocabulary import getVocabularyRegistry
+from zope.schema.vocabulary import getVocabularyRegistry, SimpleVocabulary, SimpleTerm
@adapter_config(context=IPersistent, provides=IConnection)
@@ -150,12 +151,16 @@
@provider(IVocabularyFactory)
-class ZEOConnectionVocabulary(UtilityVocabulary):
+class ZEOConnectionVocabulary(SimpleVocabulary):
"""ZEO connections vocabulary"""
interface = IZEOConnection
nameOnly = True
+ def __init__(self, context=None):
+ terms = [SimpleTerm(name, title=util.name) for name, util in get_utilities_for(IZEOConnection)]
+ super(ZEOConnectionVocabulary, self).__init__(terms)
+
getVocabularyRegistry().register('PyAMS ZEO connections', ZEOConnectionVocabulary)