Allow config items to really be required=False (#20)
In the case of `required or not default` with default defaulting to `None` it's impossible to have a `required=False` config item, without supplying a default To make `required=False` actually mean "you don't need to specify this at all", it needs to be `required and not default` when checking if we should raise `ConfigError`.
This commit is contained in:
parent
6b0c82ccde
commit
ff008a6aac
1 changed files with 1 additions and 1 deletions
|
@ -112,7 +112,7 @@ class Config(object):
|
|||
# If at any point we don't get our expected option...
|
||||
if config is None:
|
||||
# Raise an error if it was required
|
||||
if required or not default:
|
||||
if required and not default:
|
||||
raise ConfigError(f"Config option {'.'.join(path)} is required")
|
||||
|
||||
# or return the default value
|
||||
|
|
Loading…
Reference in a new issue