VMM: The Python 2.4.x compatibility commit. v0.6.x
authorPascal Volk <user@localhost.localdomain.org>
Sun, 13 Nov 2011 20:18:41 +0000
branchv0.6.x
changeset 481 90d69ae4f40d
parent 480 099de308fd98
child 482 428ee9cdf1b2
VMM: The Python 2.4.x compatibility commit.
VirtualMailManager/cli/subcommands.py
VirtualMailManager/config.py
--- a/VirtualMailManager/cli/subcommands.py	Sun Nov 13 19:59:26 2011 +0000
+++ b/VirtualMailManager/cli/subcommands.py	Sun Nov 13 20:18:41 2011 +0000
@@ -436,7 +436,8 @@
 
     for key, value in zip(keys, list_schemes()):
         if key.endswith(':'):  # who knows … (see TODO above)
-            key = key.rpartition(':')[0]
+            #key = key.rpartition(':')[0]
+            key = key[:-1]  # This one is for Py24
         w_std(key, len(key) * '-')
         w_std('\n'.join(txt_wrpr.wrap(' '.join(value))), '')
 
--- a/VirtualMailManager/config.py	Sun Nov 13 19:59:26 2011 +0000
+++ b/VirtualMailManager/config.py	Sun Nov 13 20:18:41 2011 +0000
@@ -360,14 +360,12 @@
         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)
-        finally:
-            if self._cfg_file and not self._cfg_file.closed:
-                self._cfg_file.close()
+        self._cfg_file.close()
 
     def check(self):
         """Performs a configuration check.