From cc5d7e8adb5882573a47883208e6ac8e60f35002 Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 14 Jan 2009 10:17:39 -0700 Subject: New Param: Small docstring change in Flag --- ipalib/parameter.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'ipalib/parameter.py') diff --git a/ipalib/parameter.py b/ipalib/parameter.py index 0617c84d..bfe601a9 100644 --- a/ipalib/parameter.py +++ b/ipalib/parameter.py @@ -632,6 +632,7 @@ class Bool(Param): """ type = bool + type_error = _('must be True or False') class Flag(Bool): @@ -645,16 +646,23 @@ class Flag(Bool): For example: - >>> Flag('my_flag') - Flag('my_flag', autofill=True, default=False) - >>> Flag('my_flag', default=True) # Do this for default of True - Flag('my_flag', autofill=True, default=True) + >>> 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('my_flag', autofill=False) # autofill will still be True - Flag('my_flag', autofill=True, default=False) + >>> flag = Flag('my_flag', autofill=False) + >>> flag.autofill + True """ def __init__(self, name, *rules, **kw): -- cgit