summaryrefslogtreecommitdiff
path: root/src/config.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-05-09 19:17:53 +0200
committermathieui <mathieui@mathieui.net>2012-05-09 19:17:53 +0200
commit5c327ef232522a637c3ea1960569dac697865996 (patch)
tree2bd701b37976444bcb4a20cfb6b15b69333f569a /src/config.py
parent600af6d5a71e3372262c1f3d821168f8396117ab (diff)
downloadpoezio-5c327ef232522a637c3ea1960569dac697865996.tar.gz
poezio-5c327ef232522a637c3ea1960569dac697865996.tar.bz2
poezio-5c327ef232522a637c3ea1960569dac697865996.tar.xz
poezio-5c327ef232522a637c3ea1960569dac697865996.zip
Allow a config to be set & created directly
Diffstat (limited to 'src/config.py')
-rw-r--r--src/config.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/config.py b/src/config.py
index e99572d7..6695c074 100644
--- a/src/config.py
+++ b/src/config.py
@@ -114,9 +114,12 @@ class Config(RawConfigParser):
TODO: make it write also new values in the file, not just what did already
exist
"""
- df = open(self.file_name, 'r')
- lines_before = (line.strip() for line in df.readlines())
- df.close()
+ if path.exists(self.file_name):
+ df = open(self.file_name, 'r')
+ lines_before = (line.strip() for line in df.readlines())
+ df.close()
+ else:
+ lines_before = []
result_lines = []
we_are_in_the_right_section = False
written = False