Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits:
d75b9765 by Mark Sapiro at 2021-10-04T20:24:59-07:00
Report incompatible options that would otherwise throw exceptions.
- - - - -
d570ee90 by Mark Sapiro at 2021-10-05T03:56:48+00:00
Merge branch 'memb' into 'master'
Report incompatible options that would otherwise throw exceptions in mailman
members command.
See merge request mailman/mailman!927
- - - - -
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
=====================================
@@ -148,7 +148,7 @@ def display_members(ctx, mlist, role, regular, digest,
Display only members with a given ROLE.
The role may be 'any', 'member', 'nonmember', 'owner', 'moderator',
or 'administrator' (i.e. owners and moderators).
- If not given, then delivery members are used. """))
+ If not given, then 'member' role is assumed."""))
@click.option(
'--regular', '-r',
is_flag=True, default=False,
@@ -202,6 +202,9 @@ def members(ctx, add_infp, del_infp, sync_infp, outfp,
elif sync_infp is not None:
ctx.fail('The --sync option is removed. '
'Use `mailman syncmembers` instead.')
+ elif role == 'any' and (regular or digest or nomail):
+ ctx.fail('The --regular, --digest and --nomail options are '
+ 'incompatible with role=any.')
else:
display_members(ctx, mlist, role, regular,
digest, nomail, outfp, email_only)
=====================================
src/mailman/commands/tests/test_cli_members.py
=====================================
@@ -366,3 +366,33 @@ class TestCLIMembers(unittest.TestCase):
'--email-only', 'ant.example.com'))
self.assertEqual(
result.output, '[email protected]\[email protected]\n')
+
+ def test_incompatible_role_any_regular(self):
+ result = self._command.invoke(members, (
+ '--role', 'any', '--regular', 'ant.example.com'))
+ self.assertEqual(
+ result.output,
+ 'Usage: members [OPTIONS] LISTSPEC\n'
+ 'Try \'members --help\' for help.\n\n'
+ 'Error: The --regular, --digest and --nomail options are '
+ 'incompatible with role=any.\n')
+
+ def test_incompatible_role_any_digest(self):
+ result = self._command.invoke(members, (
+ '--role', 'any', '--digest', 'any', 'ant.example.com'))
+ self.assertEqual(
+ result.output,
+ 'Usage: members [OPTIONS] LISTSPEC\n'
+ 'Try \'members --help\' for help.\n\n'
+ 'Error: The --regular, --digest and --nomail options are '
+ 'incompatible with role=any.\n')
+
+ def test_incompatible_role_any_nomail(self):
+ result = self._command.invoke(members, (
+ '--role', 'any', '--nomail', 'any', 'ant.example.com'))
+ self.assertEqual(
+ result.output,
+ 'Usage: members [OPTIONS] LISTSPEC\n'
+ 'Try \'members --help\' for help.\n\n'
+ 'Error: The --regular, --digest and --nomail options are '
+ 'incompatible with role=any.\n')
=====================================
src/mailman/docs/NEWS.rst
=====================================
@@ -8,6 +8,18 @@ Copyright (C) 1998-2021 by the Free Software Foundation, Inc.
Here is a history of user visible changes to Mailman.
+.. _news-3.3.6:
+
+3.3.6
+=====
+
+(xxxx-xx-xx)
+
+Bugs fixed
+----------
+* The ``mailman members`` command reports incompatible options that would
+ otherwise throw exceptions.
+
.. _news-3.3.5:
3.3.5
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/1b0c00174eac075ca7aa1f1348d23ac8b4630383...d570ee90af368d123e3deb26e3976f597cf09f9e
--
View it on GitLab:
https://gitlab.com/mailman/mailman/-/compare/1b0c00174eac075ca7aa1f1348d23ac8b4630383...d570ee90af368d123e3deb26e3976f597cf09f9e
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]