Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: 88d54838 by Mark Sapiro at 2019-03-20T15:43:57Z Work around click hang issue. An issue in the interaction between click ctx.exit() and contextlib.ExitStack has been worked around as suggested at https://github.com/pallets/click/issues/1134#issuecomment-436308107 Fixes #520 - - - - - 3a1d9a3d by Mark Sapiro at 2019-03-21T00:49:45Z Merge branch 'click_fix' into 'master' Work around click hang issue. Closes #520 See merge request mailman/mailman!477 - - - - - 3 changed files: - src/mailman/bin/mailman.py - src/mailman/docs/NEWS.rst - src/mailman/rest/tests/test_validator.py Changes: ===================================== src/mailman/bin/mailman.py ===================================== @@ -18,7 +18,6 @@ """The 'mailman' command dispatcher.""" import click -from contextlib import ExitStack from mailman.commands.cli_help import help as help_command from mailman.config import config from mailman.core.i18n import _ @@ -60,13 +59,14 @@ class Subcommands(click.MultiCommand): # This is here to hook command parsing into the Mailman database # transaction system. If the subcommand succeeds, the transaction is # committed, otherwise it's aborted. + # See https://github.com/pallets/click/issues/1134 def invoke(self, ctx): - with ExitStack() as resources: - # If given a bogus subcommand, the database won't have been - # initialized so there's no transaction to commit. - if config.db is not None: - resources.enter_context(transaction()) - return super().invoke(ctx) + # If given a bogus subcommand, the database won't have been + # initialized so there's no transaction to commit. + if config.db is not None: + with transaction(): + return super().invoke(ctx) + return super().invoke(ctx) # pragma: missed # https://github.com/pallets/click/issues/834 # ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -32,6 +32,9 @@ REST Command line ------------ * The ``mailman import21`` command now displays import progress. (Closes #561) +* An issue with ``mailman subcommand --help`` hanging has been worked around. + (Closes #520) + 3.2.1 ===== ===================================== src/mailman/rest/tests/test_validator.py ===================================== @@ -134,3 +134,5 @@ class TestValidators(unittest.TestCase): ValueError, email_or_regexp_validator, 'foo.example.com') self.assertRaises( ValueError, email_or_regexp_validator, '^[^@]+(') + self.assertRaises( + ValueError, email_or_regexp_validator, '') View it on GitLab: https://gitlab.com/mailman/mailman/compare/34b4f1498ad61fd62c287f4e4f4d6de62557c453...3a1d9a3d7c6b1fae8f9e27b8181ea3e1d7c863b2 -- View it on GitLab: https://gitlab.com/mailman/mailman/compare/34b4f1498ad61fd62c287f4e4f4d6de62557c453...3a1d9a3d7c6b1fae8f9e27b8181ea3e1d7c863b2 You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org