freeipa/doc/api/Flag.md
Antonio Torres 88d8534e49 Extend API documentation
This includes:

* Section about command/param info in usage guide
* Section about metadata retrieval in usage guide
* Guide about differences between CLI and API
* Access control guide (management of roles, privileges and
  permissions).
* Guide about API contexts
* JSON-RPC usage guide and JSON-to-Python conversion
* Notes about types in API Reference

Signed-off-by: Antonio Torres <antorres@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2023-04-06 08:56:35 +02:00

962 B

.. _Flag:

Flag

A boolean parameter that always gets filled in with a default value.

This Bool subclass forces autofill=True in Flag.__init__(). If no default is provided, it also fills in a default value of False. Lastly, unlike the Bool class, the default must be either True or False and cannot be None.

For example:

>>> flag = Flag('my_flag')
>>> (flag.autofill, flag.default)
(True, False)

To have a default value of True, create your Flag intance with default=True. For example:

>>> flag = Flag('my_flag', default=True)
>>> (flag.autofill, flag.default)
(True, True)

Also note that creating a Flag instance with autofill=False will have no effect. For example:

>>> flag = Flag('my_flag', autofill=False)
>>> flag.autofill
True