Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: 87f2c2ba by Mark Sapiro at 2020-05-11T16:51:29+00:00 Bounce probes are now encoded in the correct charset. - - - - - 0a4cacd4 by Mark Sapiro at 2020-05-11T16:51:30+00:00 Merge branch 'fix_712' into 'master' Bounce probes are now encoded in the correct charset. Closes #712 See merge request mailman/mailman!636 - - - - - 4 changed files: - src/mailman/app/bounces.py - src/mailman/app/tests/test_bounces.py - src/mailman/docs/NEWS.rst - src/mailman/runners/tests/test_bounce.py Changes: ===================================== src/mailman/app/bounces.py ===================================== @@ -230,7 +230,7 @@ def send_probe(member, msg=None, message_id=None): probe = UserNotification(member.address.email, probe_sender, subject, lang=member.preferred_language) probe.set_type('multipart/mixed') - notice = MIMEText(text, _charset=mlist.preferred_language.charset) + notice = MIMEText(text, _charset=member.preferred_language.charset) probe.attach(notice) if msg is not None: probe.attach(MIMEMessage(msg)) ===================================== src/mailman/app/tests/test_bounces.py ===================================== @@ -342,7 +342,8 @@ $owneraddr send_probe(self._member, self._msg) items = get_queue_messages('virgin', expected_count=1) message = items[0].msg - notice = message.get_payload(0).get_payload() + notice = message.get_payload(0).get_payload(decode=True) + notice = notice.decode(self._member.preferred_language.charset) self.assertMultiLineEqual(notice, """\ blah blah blah t...@example.com a...@example.com test-ow...@example.com ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -18,6 +18,7 @@ Bugs * When importing 2.1 lists, ignore CR characters added by browsers in headers and footers. (Closes #701) * RFC 2369 headers are now added to notification messages. (Closes #710) +* Bounce probes are now encoded in the correct charset. (Closes #712) 3.3.1 ===================================== src/mailman/runners/tests/test_bounce.py ===================================== @@ -26,6 +26,7 @@ from mailman.config import config from mailman.database.transaction import transaction from mailman.interfaces.bounce import ( BounceContext, IBounceProcessor, UnrecognizedBounceDisposition) +from mailman.interfaces.languages import ILanguageManager from mailman.interfaces.member import DeliveryStatus, MemberRole from mailman.interfaces.styles import IStyle, IStyleManager from mailman.interfaces.usermanager import IUserManager @@ -112,6 +113,21 @@ Original-Recipient: rfc822; someb...@example.com events = list(self._processor.events) self.assertEqual(len(events), 0) + def test_send_probe_non_ascii(self): + # Send a pobe from an English language list to a user with non-ascii + # preferred language. + language_manager = getUtility(ILanguageManager) + self._mlist.preferred_language = language_manager.get('en') + # French charset is utf-8, but testing has it as latin-1 + french = language_manager.get('fr') + french.charset = 'utf-8' + self._member.address.preferences.preferred_language = french + send_probe(self._member, self._msg) + items = get_queue_messages('virgin', expected_count=1) + msg = items[0].msg + self.assertIn(b'a...@example.com', + msg.get_payload()[0].get_payload(decode=True)) + def test_verp_probe_bounce(self): # A VERP probe bounced. The primary difference here is that the # registered bounce event will have a different context. The View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/bde67ed83301f07f0fd01b2b0e7b7b23749e4acc...0a4cacd4a4a16649934579218e0509ecd7f46f49 -- View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/bde67ed83301f07f0fd01b2b0e7b7b23749e4acc...0a4cacd4a4a16649934579218e0509ecd7f46f49 You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list -- mailman-checkins@python.org To unsubscribe send an email to mailman-checkins-le...@python.org https://mail.python.org/mailman3/lists/mailman-checkins.python.org/ Member address: arch...@jab.org