From: Matthijs Kooijman Date: Fri, 6 Aug 2010 16:22:46 +0000 (+0200) Subject: config: Allow specifying configuration values with no default. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fprojects%2Fbackupninja.git;a=commitdiff_plain;h=1c6d83b667a24c550a8e67cd7b4161b363647c2a;ds=sidebyside config: Allow specifying configuration values with no default. By specifying a default of None, a config value will have no default. We could just leave out the value alltogether, but this way even values without a default are "documented" (this will be extended later). --- diff --git a/src/lib/backupninja/config.py b/src/lib/backupninja/config.py index 0720f0a..030fc57 100644 --- a/src/lib/backupninja/config.py +++ b/src/lib/backupninja/config.py @@ -89,4 +89,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)