summaryrefslogtreecommitdiffstats
path: root/fb.py
diff options
context:
space:
mode:
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