diff --git a/confuse/core.py b/confuse/core.py index 7d00d9c..85f0e63 100644 --- a/confuse/core.py +++ b/confuse/core.py @@ -307,6 +307,9 @@ def as_path(self): def as_choice(self, choices): """Get the value from a list of choices. Equivalent to `get(Choice(choices))`. + + Sequences, dictionaries and :class:`Enum` types are supported, + see :class:`confuse.templates.Choice` for more details. """ return self.get(templates.Choice(choices)) diff --git a/confuse/templates.py b/confuse/templates.py index a46b57a..19e79d1 100644 --- a/confuse/templates.py +++ b/confuse/templates.py @@ -243,6 +243,9 @@ def convert(self, value, view): class Choice(Template): """A template that permits values from a sequence of choices. + + Sequences, dictionaries and :class:`Enum` types are supported, + see :meth:`__init__` for usage. """ def __init__(self, choices, default=REQUIRED): """Create a template that validates any of the values from the diff --git a/docs/api.rst b/docs/api.rst index 0a094f8..f2902f1 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -34,6 +34,7 @@ Templates .. automodule:: confuse.templates :members: :private-members: + :special-members: __init__ :show-inheritance: Utility