From bd2d63f8a53b8a646a7da95d2e2c23bf0bde04a3 Mon Sep 17 00:00:00 2001 From: Florent Le Coz Date: Tue, 5 Jul 2011 23:48:28 +0200 Subject: Check that all needed config sections are there at startup, and create them if not --- src/config.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/config.py b/src/config.py index 9cedcac7..ee37b9a9 100644 --- a/src/config.py +++ b/src/config.py @@ -35,6 +35,10 @@ class Config(RawConfigParser): self.file_name = file_name RawConfigParser.__init__(self, None) RawConfigParser.read(self, file_name) + # Check config integrity and fix it if it’s wrong + for section in ('bindings', 'var'): + if not self.has_section(section): + self.add_section(section) def get(self, option, default, section=DEFSECTION): """ -- cgit v1.2.3