diff --git a/option.py b/option.py index e305d4a..bbc471d 100644 --- a/option.py +++ b/option.py @@ -81,7 +81,7 @@ class Option(HiddenBaseType, DisabledBaseType, ModeBaseType): if who == "default" and value is None: self.default = None return - if not self.validate(value): + if value != None and not self.validate(value): raise ConfigError('invalid value %s for option %s' % (value, name)) if who == "default": # changes the default value (and therefore resets the previous value) diff --git a/test/test_config.py b/test/test_config.py index a18cf60..577488a 100644 --- a/test/test_config.py +++ b/test/test_config.py @@ -33,6 +33,14 @@ def test_base_config(): assert cfg.dummy == False dm = cfg.unwrap_from_path('dummy') assert dm._name == 'dummy' + +def test_toto(): + descr = make_description() + cfg = Config(descr) + assert cfg.gc.dummy == False + cfg.gc.dummy = True + assert cfg.gc.dummy == True + cfg.gc.dummy = None def test_base_config_and_groups(): descr = make_description()