Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: ce424e80 by Mark Sapiro at 2023-10-28T08:45:32-07:00 Fall back to user.display_name in maliman members command. - - - - - fd120572 by Mark Sapiro at 2023-10-28T17:15:04+00:00 Merge branch 'member' into 'master' Fall back to user.display_name in maliman members command. Closes #1107 See merge request mailman/mailman!1151 Merged-by: Mark Sapiro <m...@msapiro.net> Reviewed-by: - - - - - 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 ===================================== @@ -103,10 +103,11 @@ 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 or not address.display_name: + dn = address.display_name or member.user.display_name + if email_only or not dn: print(address.original_email, file=outfp) else: - print(f'{address.display_name} <{address.original_email}>', + print(f'{dn} <{address.original_email}>', file=outfp) ===================================== src/mailman/commands/tests/test_cli_members.py ===================================== @@ -101,6 +101,17 @@ class TestCLIMembers(unittest.TestCase): self.assertEqual(len(lines), 1) self.assertEqual(lines[0], 'Cate Person <cper...@example.com>\n') + def test_display_name_fallback(self): + member = subscribe(self._mlist, 'Anne', role=MemberRole.member) + member.address.display_name = None + with NamedTemporaryFile('w', encoding='utf-8') as outfp: + self._command.invoke(members, ( + '--role', 'member', '-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], 'Anne Person <aper...@example.com>\n') + def test_already_subscribed_with_display_name(self): subscribe(self._mlist, 'Anne') with NamedTemporaryFile('w', buffering=1, encoding='utf-8') as infp: ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -7,6 +7,18 @@ Copyright (C) 1998-2022 by the Free Software Foundation, Inc. Here is a history of user visible changes to Mailman. +.. _news-3.3.10: + +3.3.10 +====== + +(xxxx-xx-xx) + +Bugs fixed +---------- +* The ``mailman members`` command will now fall back to the member's user + record display_name if the address record has none. (Closes #1107) + .. _news-3.3.9: 3.3.9 View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/92c6a1fffffd75428e9909c8f2943c86b21ab271...fd1205726642347762e27b355f1770e9f745eaa4 -- View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/92c6a1fffffd75428e9909c8f2943c86b21ab271...fd1205726642347762e27b355f1770e9f745eaa4 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