VMM/config: Undone changeset 90d69ae4f40d. v0.7.x
authorPascal Volk <user@localhost.localdomain.org>
Tue, 06 Nov 2012 23:23:55 +0000
branchv0.7.x
changeset 641 724ac0a4068d
parent 640 ebacd11563b0
child 642 4cd9d0a9f42f
VMM/config: Undone changeset 90d69ae4f40d.
VirtualMailManager/config.py
--- a/VirtualMailManager/config.py	Tue Nov 06 21:45:50 2012 +0000
+++ b/VirtualMailManager/config.py	Tue Nov 06 23:23:55 2012 +0000
@@ -357,12 +357,14 @@
         Raises a ConfigError if the configuration syntax is
         invalid.
         """
-        self._cfg_file = open(self._cfg_filename, 'r')
         try:
+            self._cfg_file = open(self._cfg_filename, 'r')
             self.readfp(self._cfg_file)
         except (MissingSectionHeaderError, ParsingError), err:
             raise ConfigError(str(err), CONF_ERROR)
-        self._cfg_file.close()
+        finally:
+            if self._cfg_file and not self._cfg_file.closed:
+                self._cfg_file.close()
 
     def check(self):
         """Performs a configuration check.