make update of new settings a bit more general and remove some whitespace

* config.update(default_config) does not work, would overwrite all values
This commit is contained in:
Stephan Gabler 2012-04-26 09:42:25 +02:00
parent 530514c7ac
commit e8435a0445

View file

@ -357,8 +357,12 @@ if __name__ == "__main__":
else:
with open(CONFIG_PATH) as f:
config = json.load(f)
if not 'highlight' in config:
config['highlight'] = False
# update config file with settings introduced in a later version
missing_keys = set(default_config).difference(config)
if missing_keys:
for key in missing_keys:
config[key] = default_config[key]
with open(CONFIG_PATH, 'w') as f:
json.dump(config, f, indent=2)