Message156238
Currently my /usr/lib/python3.2/email/encoders.py has this code:
def _qencode(s):
enc = _encodestring(s, quotetabs=True)
# Must encode spaces, which quopri.encodestring() doesn't do
return enc.replace(' ', '=20')
The problem is that _encodestring (which is just quopri.encodestring) always returns bytes, trying to run replace() on bytes raises "TypeError: expected an object with the buffer interface".
This leads to email.encoders.encode_quopri never working.
So, I think this should be changed to something like this:
<...>
return enc.decode().replace(' ', '=20')
Example log:
Python 3.2.3rc1 (default, Mar 9 2012, 23:02:43)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import email.encoders
>>> from email.mime.text import MIMEText
>>> msg = MIMEText(b'some text here')
>>> email.encoders.encode_quopri(msg)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.2/email/encoders.py", line 44, in encode_quopri
encdata = _qencode(orig)
File "/usr/lib/python3.2/email/encoders.py", line 23, in _qencode
return enc.replace(' ', '=20')
TypeError: expected an object with the buffer interface
Reproduced on Ubuntu precise with Python 3.2.3rc1. Replacing encode_quopri with encode_base64 works fine. |
|
Date |
User |
Action |
Args |
2012-03-18 09:36:35 | mitya57 | set | recipients:
+ mitya57, barry |
2012-03-18 09:36:35 | mitya57 | set | messageid: <1332063395.16.0.293436373736.issue14360@psf.upfronthosting.co.za> |
2012-03-18 09:36:34 | mitya57 | link | issue14360 messages |
2012-03-18 09:36:33 | mitya57 | create | |
|