aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/config.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@drexel.edu>2009-06-21 07:56:05 -0400
committerW. Trevor King <wking@drexel.edu>2009-06-21 07:56:05 -0400
commit8aa307584c1e35dfde114e04ace12b7862579014 (patch)
treededce65eb6fe3dd53318a8acc9e0c7e7ca0f9ff3 /libbe/config.py
parent47901fbf10ba498a91a4701129a2f1959d00df67 (diff)
downloadbugseverywhere-8aa307584c1e35dfde114e04ace12b7862579014.tar.gz
Touch missing userwide config file before read if it's missing.
Another bug introduced by James Rowe's user-config patch. Obviously it's hard to read a file if there's no file there. I'm not sure how it passed the unit tests earlier. Maybe I forgot to install the pre-commit version before running the test suite... Anyhow, fixed now.
Diffstat (limited to 'libbe/config.py')
-rw-r--r--libbe/config.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/libbe/config.py b/libbe/config.py
index 9b1682a..e696eeb 100644
--- a/libbe/config.py
+++ b/libbe/config.py
@@ -37,6 +37,8 @@ def set_val(name, value, section="DEFAULT", encoding=None):
if encoding == None:
encoding = default_encoding
config = ConfigParser.ConfigParser()
+ if os.path.exists(path()) == False: # touch file or config
+ open(path(), "w").close() # read chokes on missing file
f = codecs.open(path(), "r", encoding)
config.readfp(f, path())
f.close()