VirtualMailManager/cli/config.py
branchv0.7.x
changeset 642 4cd9d0a9f42f
parent 568 14abdd04ddf5
child 643 df1e3b67882a
--- a/VirtualMailManager/cli/config.py	Tue Nov 06 23:23:55 2012 +0000
+++ b/VirtualMailManager/cli/config.py	Sun Nov 11 16:53:52 2012 +0000
@@ -89,8 +89,7 @@
     def _save_changes(self):
         """Writes changes to the configuration file."""
         copy2(self._cfg_filename, self._cfg_filename + '.bak')
-        self._cfg_file = open(self._cfg_filename, 'w')
-        self.write(self._cfg_file)
-        self._cfg_file.close()
+        with open(self._cfg_filename, 'w') as self._cfg_file:
+            self.write(self._cfg_file)
 
 del _