|
OpenQuizz
Une application de gestion des contenus pédagogiques
|


Public Member Functions | |
| def | __init__ (self, choices, case_sensitive=True) |
| def | get_metavar (self, param) |
| def | get_missing_message (self, param) |
| def | convert (self, value, param, ctx) |
| def | __repr__ (self) |
Public Member Functions inherited from ParamType | |
| def | __call__ (self, value, param=None, ctx=None) |
| def | split_envvar_value (self, rv) |
| def | fail (self, message, param=None, ctx=None) |
Data Fields | |
| choices | |
| case_sensitive | |
Static Public Attributes | |
| string | name = "choice" |
Static Public Attributes inherited from ParamType | |
| bool | is_composite = False |
| name = None | |
| envvar_list_splitter = None | |
The choice type allows a value to be checked against a fixed set
of supported values. All of these values have to be strings.
You should only pass a list or tuple of choices. Other iterables
(like generators) may lead to surprising results.
The resulting value will always be one of the originally passed choices
regardless of ``case_sensitive`` or any ``ctx.token_normalize_func``
being specified.
See :ref:`choice-opts` for an example.
:param case_sensitive: Set to false to make choices case
insensitive. Defaults to true.
| def __init__ | ( | self, | |
| choices, | |||
case_sensitive = True |
|||
| ) |
| def __repr__ | ( | self | ) |
| def convert | ( | self, | |
| value, | |||
| param, | |||
| ctx | |||
| ) |
Converts the value. This is not invoked for values that are `None` (the missing value).
Reimplemented from ParamType.
| def get_metavar | ( | self, | |
| param | |||
| ) |
Returns the metavar default for this param if it provides one.
Reimplemented from ParamType.
| def get_missing_message | ( | self, | |
| param | |||
| ) |
Optionally might return extra information about a missing parameter. .. versionadded:: 2.0
Reimplemented from ParamType.
| case_sensitive |
| choices |
|
static |