# HG changeset patch # User Thierry Florac # Date 1479763517 -3600 # Node ID 13f3fb3fc4ef92230eebaf933875d93646b719e4 # Parent b183ee9e7ea14ed2f7d4bd5a75ecf1adcbae7fe4 Updated docstring diff -r b183ee9e7ea1 -r 13f3fb3fc4ef src/pyams_utils/vocabulary.py --- a/src/pyams_utils/vocabulary.py Sun Nov 20 12:58:54 2016 +0100 +++ b/src/pyams_utils/vocabulary.py Mon Nov 21 22:25:17 2016 +0100 @@ -37,7 +37,7 @@ from pyams_utils.interfaces.zeo import IZEOConnection from pyams_utils.registry import get_utilities_for - from pyams_utils.vocabulary import voacbulary_config + from pyams_utils.vocabulary import vocabulary_config from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary @vocabulary_config(name='PyAMS ZEO connections') @@ -47,6 +47,21 @@ def __init__(self, context=None): terms = [SimpleTerm(name, title=util.name) for name, util in get_utilities_for(IZEOConnection)] super(ZEOConnectionVocabulary, self).__init__(terms) + + You can then use such a vocabulary in any schema field: + + .. code-block:: python + + from zope.interface import Interface + from zope.schema import Choice + + class MySchema(Interface): + '''Custom schema interface''' + + zeo_connection_name = Choice(title='ZEO connection name', + description='Please select a registered ZEO connection', + vocabulary='PyAMS ZEO connections', + required=False) """ def __init__(self, name):