formular._utils - Miscellaneous Utilities

This module provides miscellaneous utilities used by Formular.

_make_name(parent, child)
>>> _make_name(None, "eggs")
"eggs"
>>> _make_name("spam", "eggs")
"spam.eggs"
_get_args(func)
Returns the positional arguments and the keyword arguments of a given function.
_get_cls_args(cls)

Returns the positional arguments and the keyword arguments of a given class.

The keyword arguments will contain any keyword argument used in any superclass of the given class.

_value_matches_choice(value, choice)
Returns True if the given value matches the given choice.
_is_choice_selected(field, choice)
Returns True if the given choice is one of the choices selected by the given field.
_iter_choices(choices)
Yields (value, label) tuples for the given choices.
_to_list(obj)
Returns a list representing the given obj if it’s iterable and not a string or a list containing the given obj otherwise.

Previous topic

formular._csrf - CSRF Utilities

Next topic

How To Use Formular With...

This Page