summaryrefslogtreecommitdiffstats
path: root/fb.py
diff options
context:
space:
mode:
authorDirk Mallunat <s4msung@exigen.org>2016-07-05 00:09:20 +0200
committerFlorian Pritz <bluewind@xinu.at>2016-07-05 00:19:07 +0200
commit29634278eb84fcdd1b29b85ed2ce8c5250e4a183 (patch)
treeccf730e10728e1fac05bae6d7937be540d3f1c88 /fb.py
parent5455b5edefd5f1d6b99ca5f5d1b9d471df25045b (diff)
Close config file
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb.py')
-rwxr-xr-xfb.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/fb.py b/fb.py
index 1557ed9..4e46c1f 100755
--- a/fb.py
+++ b/fb.py
@@ -385,10 +385,11 @@ class ConfigParser:
if ignoreMissing:
return
- for line in fh.readlines():
- matches = re.match('^(?P<key>[^=]+)=(?P<quotechar>"?)(?P<value>.+)(?P=quotechar)$', line)
- if matches != None:
- self.config[matches.group('key')] = matches.group('value')
+ with fh:
+ for line in fh:
+ matches = re.match('^(?P<key>[^=]+)=(?P<quotechar>"?)(?P<value>.+)(?P=quotechar)$', line)
+ if matches != None:
+ self.config[matches.group('key')] = matches.group('value')
def get_config(self):
return self.config