diff options
author | Guido Günther <agx@sigxcpu.org> | 2009-02-27 12:49:13 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2009-02-27 13:03:23 +0100 |
commit | eceac16df7821d27ce5ca010d341bafb66c0c71f (patch) | |
tree | 8d73cc0296fbf80fec457c1b05123b1bd3a153f4 | |
parent | fe09cfa9d861deea38237a4ea37de9f59e0eba13 (diff) |
be less strict on the spelling of boolen config file options
any capitalization of 'true' or 'false' as well as '0' and '1' are
allowed.
-rw-r--r-- | gbp/config.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gbp/config.py b/gbp/config.py index 31ba36b..2cf294b 100644 --- a/gbp/config.py +++ b/gbp/config.py @@ -132,11 +132,13 @@ class GbpOptionParser(OptionParser): except KeyError: default = self.config[neg] - if default in [ 'True', 'False' ]: - ret = eval(default) + if default.lower() in ["true", "1" ]: + val = 'True' + elif default.lower() in ["false", "0" ]: + val = 'False' else: raise ValueError, "Boolean options must be True or False" - return ret + return eval(val) def get_default(self, option_name, **kwargs): """get the default value""" |