Author: christian.heimes
Date: Tue Nov  6 19:43:23 2007
New Revision: 58881

Modified:
   python/branches/py3k-pep3137/Lib/mailbox.py
   python/branches/py3k-pep3137/Lib/test/test_mailbox.py
Log:
Fixed (most) problems with test_mailbox and test_old_mailbox
Andrew Kuchling said: I think mailboxes should be 7-bit clean in
theory, but have no idea if things are that tidy in practice.

I agree with him but I've no way to test it with real data. Can somebody with a 
Qmail setup test the changes with real data? Otherwise we have to see how the 
code change behaves in the wild.

Modified: python/branches/py3k-pep3137/Lib/mailbox.py
==============================================================================
--- python/branches/py3k-pep3137/Lib/mailbox.py (original)
+++ python/branches/py3k-pep3137/Lib/mailbox.py Tue Nov  6 19:43:23 2007
@@ -333,7 +333,7 @@
 
     def get_file(self, key):
         """Return a file-like representation or raise a KeyError."""
-        f = open(os.path.join(self._path, self._lookup(key)), 'rb')
+        f = open(os.path.join(self._path, self._lookup(key)), 'r')
         return _ProxyFile(f)
 
     def iterkeys(self):
@@ -936,7 +936,7 @@
     def get_file(self, key):
         """Return a file-like representation or raise a KeyError."""
         try:
-            f = open(os.path.join(self._path, str(key)), 'rb')
+            f = open(os.path.join(self._path, str(key)), 'r')
         except IOError as e:
             if e.errno == errno.ENOENT:
                 raise KeyError('No message with key: %s' % key)

Modified: python/branches/py3k-pep3137/Lib/test/test_mailbox.py
==============================================================================
--- python/branches/py3k-pep3137/Lib/test/test_mailbox.py       (original)
+++ python/branches/py3k-pep3137/Lib/test/test_mailbox.py       Tue Nov  6 
19:43:23 2007
@@ -170,9 +170,9 @@
         key1 = self._box.add(_sample_message)
         data0 = self._box.get_file(key0).read()
         data1 = self._box.get_file(key1).read()
-        self.assertEqual(data0.decode().replace(os.linesep, '\n'),
+        self.assertEqual(data0.replace(os.linesep, '\n'),
                          self._template % 0)
-        self.assertEqual(data1.decode().replace(os.linesep, '\n'),
+        self.assertEqual(data1.replace(os.linesep, '\n'),
                          _sample_message)
 
     def test_iterkeys(self):
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to