From a26ed5b02a76dd26a72eb8acad819be47dca3049 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Tue, 24 Nov 2009 23:36:14 -0500 Subject: Add a development mode setting which changes the basic behavior of mailman. The only thing it does currently is force the recipients in the low level connection code to a hard-coded address. Also: * Fix the inject command's --filename/-f argument * Make inject's LISTNAME required * When inject reads from stdin, capture C-c and print a nicer message * Extend the members command so that blank lines and lines starting with # are ignored. * members command should not fail when an address is already subscribed. Just warn and continue. --- src/mailman/commands/cli_inject.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/mailman/commands/cli_inject.py') diff --git a/src/mailman/commands/cli_inject.py b/src/mailman/commands/cli_inject.py index 025dcb036..8b7570e0a 100644 --- a/src/mailman/commands/cli_inject.py +++ b/src/mailman/commands/cli_inject.py @@ -60,13 +60,12 @@ class Inject: help=_('Show a list of all available queue names and exit.')) command_parser.add_argument( '-f', '--filename', - type='string', help=_(""" + type=unicode, help=_(""" Name of file containing the message to inject. If not given, or - '-' (without the quotes) standard input is used. - """)) + '-' (without the quotes) standard input is used.""")) # Required positional argument. command_parser.add_argument( - 'listname', metavar='LISTNAME', nargs='?', + 'listname', metavar='LISTNAME', nargs=1, help=_("""\ The 'fully qualified list name', i.e. the posting address of the mailing list to inject the message into.""")) @@ -97,7 +96,11 @@ class Inject: self.parser.error(_('No such queue: $queue')) return if args.filename in (None, '-'): - message_text = sys.stdin.read() + try: + message_text = sys.stdin.read() + except KeyboardInterrupt: + print 'Interrupted' + sys.exit(1) else: with open(args.filename) as fp: message_text = fp.read() -- cgit v1.2.3-70-g09d2