From a41b036155d2c544e7c35edd743fc85219ae1977 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Fri, 17 Dec 2010 14:48:31 +0000 Subject: [PATCH] Also catch errors on config save --- src/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/config.py b/src/config.py index 4bb646b3..97be4946 100644 --- a/src/config.py +++ b/src/config.py @@ -123,7 +123,11 @@ class Config(RawConfigParser): set the value in the configuration then save it to the file """ - RawConfigParser.set(self, section, option, value) + try: + RawConfigParser.set(self, section, option, value) + except NoSectionError: + # TODO, add this section if it didn't exist + return self.write_in_file(section, option, value) # creates the configuration directory if it doesn't exist