mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-01-26 16:16:31 -06:00
Fix Bool parameter type. It was impossible to set it to FALSE.
This commit is contained in:
parent
ce72b59f55
commit
973f36c496
@ -764,7 +764,7 @@ class cli(backend.Executioner):
|
||||
)
|
||||
if option.password and self.env.interactive:
|
||||
kw['action'] = 'store_true'
|
||||
elif option.type is bool:
|
||||
elif option.type is bool and option.autofill:
|
||||
if option.default is True:
|
||||
kw['action'] = 'store_false'
|
||||
else:
|
||||
|
@ -799,8 +799,8 @@ class Bool(Param):
|
||||
# FIXME: This my quick hack to get some UI stuff working, change these defaults
|
||||
# --jderose 2009-08-28
|
||||
kwargs = Param.kwargs + (
|
||||
('truths', frozenset, frozenset([1, u'1', u'True'])),
|
||||
('falsehoods', frozenset, frozenset([0, u'0', u'False'])),
|
||||
('truths', frozenset, frozenset([1, u'1', u'true'])),
|
||||
('falsehoods', frozenset, frozenset([0, u'0', u'false'])),
|
||||
)
|
||||
|
||||
def _convert_scalar(self, value, index=None):
|
||||
@ -809,6 +809,8 @@ class Bool(Param):
|
||||
"""
|
||||
if type(value) is self.type:
|
||||
return value
|
||||
if isinstance(value, basestring):
|
||||
value = value.lower()
|
||||
if value in self.truths:
|
||||
return True
|
||||
if value in self.falsehoods:
|
||||
|
Loading…
Reference in New Issue
Block a user