Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits:
9e1deb4a by Mark Sapiro at 2022-12-30T22:37:07+00:00
Don't RFC 2047 encode non-ascii display names in mailman members output.
Fixes #1048
- - - - -
197ba91d by Mark Sapiro at 2022-12-30T22:37:07+00:00
Merge branch 'memb' into 'master'
Don't RFC 2047 encode non-ascii display names in mailman members output.
Closes #1048
See merge request mailman/mailman!1079
- - - - -
3 changed files:
- src/mailman/commands/cli_members.py
- src/mailman/commands/tests/test_cli_members.py
- src/mailman/docs/NEWS.rst
Changes:
=====================================
src/mailman/commands/cli_members.py
=====================================
@@ -19,7 +19,6 @@
import click
-from email.utils import formataddr
from mailman.core.i18n import _
from mailman.interfaces.command import ICLISubCommand
from mailman.interfaces.listmanager import IListManager
@@ -104,10 +103,10 @@ def display_members(ctx, mlist, role, regular, digest,
if nomail is not None:
if member.delivery_status not in status_types:
continue
- if email_only:
+ if email_only or not address.display_name:
print(address.original_email, file=outfp)
else:
- print(formataddr((address.display_name, address.original_email)),
+ print(f'{address.display_name} <{address.original_email}>',
file=outfp)
=====================================
src/mailman/commands/tests/test_cli_members.py
=====================================
@@ -414,3 +414,13 @@ class TestCLIMembers(unittest.TestCase):
'Try \'members --help\' for help.\n\n'
'Error: The --regular, --digest and --nomail options are '
'incompatible with role=any.\n')
+
+ def test_non_ascii_display_name(self):
+ subscribe(self._mlist, 'Bögüs', role=MemberRole.member)
+ with NamedTemporaryFile('w', encoding='utf-8') as outfp:
+ self._command.invoke(members, (
+ '-o', outfp.name, 'ant.example.com'))
+ with open(outfp.name, 'r', encoding='utf-8') as infp:
+ lines = infp.readlines()
+ self.assertEqual(len(lines), 1)
+ self.assertEqual(lines[0], 'Bögüs Person <[email protected]>\n')
=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -24,6 +24,12 @@ Bugs fixed
caught and handled appropriately. (Closes #1046)
+Command line
+------------
+* The ``mailman members`` command no longer RFC 2047 encodes non-ascii display
+ names. (Closes #1048)
+
+
Performance
-----------
* Improve the performance of Held message handling by reducing the total
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/a7ece0b354cf6d237b65e787ffbb327af556663b...197ba91d2b4ed5e3838d4a2c4165a4ec48da458b
--
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/a7ece0b354cf6d237b65e787ffbb327af556663b...197ba91d2b4ed5e3838d4a2c4165a4ec48da458b
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/mailman-checkins.python.org/
Member address: [email protected]