#21093 closed Bug (fixed)
regressiontests.mail.tests.MailTests.test_dont_base64_encode() fails with Python >=3.3.3
Reported by: | Arfrever | Owned by: | nobody |
---|---|---|---|
Component: | Testing framework | Version: | dev |
Severity: | Release blocker | Keywords: | |
Cc: | Arfrever, Florian Apolloner | Triage Stage: | Accepted |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
regressiontests.mail.tests.MailTests.test_dont_base64_encode() fails with Python >=3.3.3 since Python commit 64e004737837.
It passes with older versions of Python.
I use Django 1.5.3.
$ PYTHONPATH="." python3.3 tests/runtests.py --settings=test_sqlite -v0 mail.MailTests.test_dont_base64_encode ====================================================================== FAIL: test_dont_base64_encode (regressiontests.mail.tests.MailTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/Django-1.5.3/tests/regressiontests/mail/tests.py", line 330, in test_dont_base64_encode self.assertTrue(str('Content-Transfer-Encoding: 8bit') in s) AssertionError: False is not True ---------------------------------------------------------------------- Ran 1 test in 0.025s FAILED (failures=1)
Variable 's' contains 'Content-Transfer-Encoding: 8bit' with older versions of Python and 'Content-Transfer-Encoding: 7bit' with Python >=3.3.3.
Change History (11)
comment:1 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Bug |
comment:2 by , 11 years ago
Cc: | added |
---|
comment:3 by , 11 years ago
Cc: | added |
---|
comment:5 by , 11 years ago
Severity: | Normal → Release blocker |
---|---|
Version: | 1.5 → master |
We should review if our smtp backend properly sends mails on python 3.3+
comment:6 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:10 by , 11 years ago
regarding message.py:
I think that rather than re-encoding the message in SafeMimeText you should set the encoding globally for python using:
Charset.add_charset('utf-8', Charset.SHORTEST, None, 'utf-8')
Note:
u1 = Charset.Charset('utf-8')
u1.body_encoding = None
u2 = Charset.Charset('utf-8')
u2.body_encoding != u1.body_encoding
comment:11 by , 11 years ago
See https://github.com/django/django/blob/280c1a65ccacd679bf298bf2b169ff01e7266b8e/django/core/mail/message.py#L26 -- we purposely don't want to change anything globally. also are you talking about the 3.3.3 fix, or the 3.3.3+ fix and how exactly would your patch look like (and why would it be better than what we have now and would the tests pass ;))?
I think get_payload in python shouldn't decode the message, I am in contact with the author of the patch, hopefully we can get that fixed for python 3.3.3 :)