core3: boolean properties can be set explicitely
This commit is contained in:
parent
b4d51b016b
commit
17ac6cb225
@ -757,13 +757,16 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name
|
||||
:py:obj:`True`.
|
||||
''' # pylint: disable=bad-staticmethod-argument,unused-argument
|
||||
|
||||
lcvalue = value.lower()
|
||||
if lcvalue in ('0', 'no', 'false'):
|
||||
return False
|
||||
if lcvalue in ('1', 'yes', 'true'):
|
||||
return True
|
||||
raise ValueError(
|
||||
'Invalid literal for boolean property: {!r}'.format(value))
|
||||
if isinstance(value, basestring):
|
||||
lcvalue = value.lower()
|
||||
if lcvalue in ('0', 'no', 'false', 'off'):
|
||||
return False
|
||||
if lcvalue in ('1', 'yes', 'true', 'on'):
|
||||
return True
|
||||
raise ValueError(
|
||||
'Invalid literal for boolean property: {!r}'.format(value))
|
||||
|
||||
return bool(value)
|
||||
|
||||
|
||||
|
||||
|
@ -68,7 +68,7 @@ class TC_90_globals(qubes.tests.QubesTestCase):
|
||||
qid=0, name='dom0', internal='False')
|
||||
|
||||
self.assertFalse(flag(None, vm))
|
||||
vm.internal = 'True'
|
||||
vm.internal = True
|
||||
self.assertTrue(flag(None, vm))
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user