X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fbackupninja.git;a=blobdiff_plain;f=src%2Flib%2Fbackupninja%2Fconfig.py;h=5f1b283094a8f27641ab327a622163650ef58e26;hp=0720f0aa05e36f6c38824728de1d86bee957ca41;hb=HEAD;hpb=d64d30066c2cbcf02e1c4d05198ca430584b5cbd diff --git a/src/lib/backupninja/config.py b/src/lib/backupninja/config.py index 0720f0a..5f1b283 100644 --- a/src/lib/backupninja/config.py +++ b/src/lib/backupninja/config.py @@ -28,6 +28,15 @@ default_global_config = {} import logging as log +class ConfigError(Exception): + """ + An exception thrown when something is wrong with the config. + This is not thrown by the config module, but it is meant to be + thrown by handlers when they find something wrong with the + configuration contents. + """ + pass + def get_global_config(opts): """ Returns the global configuration, in a SafeConfigParser object. @@ -89,4 +98,7 @@ def _set_default_config(parser, values): if not parser.has_section(section): parser.add_section(section) for option, value in options.items(): - parser.set(section, option, value) + # Interpret None as "no default", since ConfigParser doesn't + # like non-string values. + if not value is None: + parser.set(section, option, value)