Hopefully the final UnicodeDecodeError fix for the Config class
authorPascal Volk <neverseen@users.sourceforge.net>
Mon, 17 Aug 2009 04:56:13 +0000
changeset 112 d1f345f91e1c
parent 111 50ff50f5055e
child 113 e35755191ff3
Hopefully the final UnicodeDecodeError fix for the Config class Added a global w_std() function and replaced all print statements.
VirtualMailManager/Config.py
--- a/VirtualMailManager/Config.py	Sun Aug 16 04:14:38 2009 +0000
+++ b/VirtualMailManager/Config.py	Mon Aug 17 04:56:13 2009 +0000
@@ -21,6 +21,11 @@
 locale.setlocale(locale.LC_ALL, '')
 ENCODING = locale.nl_langinfo(locale.CODESET)
 
+def w_std(*args):
+    for arg in args:
+        sys.stdout.write(arg.encode(ENCODING, 'replace'))
+        sys.stdout.write('\n')
+
 class Config(ConfigParser):
     """This class is for configure the Virtual Mail Manager.
 
@@ -125,11 +130,10 @@
         except ValueError:
             self.set('config', 'done', 'False')
             self.__changes = True
-        print _(u"Using configuration file: %s\n").encode(ENCODING,
-                'replace') % self.__cfgFileName
+        w_std(_(u'Using configuration file: %s\n') % self.__cfgFileName)
         for s in sections:
             if s != 'config':
-                print _(u'* Config section: »%s«').encode(ENCODING,'replace')%s
+                w_std(_(u'* Config section: »%s«') % s )
             for opt, val in self.items(s):
                 newval = raw_input(
                 _('Enter new value for option %(opt)s [%(val)s]: ').encode(