python: added __nonzero__ function to SimObject Bool params

This commit is contained in:
Brad Beckmann 2012-04-06 13:47:07 -07:00
parent f050ebe3a8
commit f12961bf25

View file

@ -639,6 +639,11 @@ class Bool(ParamValue):
def __str__(self): def __str__(self):
return str(self.value) return str(self.value)
# implement truth value testing for Bool parameters so that these params
# evaluate correctly during the python configuration phase
def __nonzero__(self):
return bool(self.value)
def ini_str(self): def ini_str(self):
if self.value: if self.value:
return 'true' return 'true'