Updated docstring
authorThierry Florac <tflorac@ulthar.net>
Mon, 21 Nov 2016 22:25:17 +0100
changeset 77 13f3fb3fc4ef
parent 76 b183ee9e7ea1
child 78 54aeb42c0d80
Updated docstring
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):