diff options
| author | Barry Warsaw | 2008-08-12 20:54:04 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2008-08-12 20:54:04 -0400 |
| commit | ae24685f77661f19ee0357e9328737b6a3251596 (patch) | |
| tree | c9129496aaf12ca3ce126099f89967b6ce751a2a /mailman/queue | |
| parent | 67e437883d520bf7ea78ae55235892aa946ef0b4 (diff) | |
| download | mailman-ae24685f77661f19ee0357e9328737b6a3251596.tar.gz mailman-ae24685f77661f19ee0357e9328737b6a3251596.tar.zst mailman-ae24685f77661f19ee0357e9328737b6a3251596.zip | |
Checkpointing new command infrastructure.
- Add join command
- Add echo command
- Add end command
Diffstat (limited to 'mailman/queue')
| -rw-r--r-- | mailman/queue/command.py | 9 | ||||
| -rw-r--r-- | mailman/queue/docs/command.txt | 65 |
2 files changed, 72 insertions, 2 deletions
diff --git a/mailman/queue/command.py b/mailman/queue/command.py index e9009809e..9c547184c 100644 --- a/mailman/queue/command.py +++ b/mailman/queue/command.py @@ -44,7 +44,7 @@ from mailman import Utils from mailman.app.replybot import autorespond_to_sender from mailman.configuration import config from mailman.i18n import _ -from mailman.interfaces import IEmailResults +from mailman.interfaces import ContinueProcessing, IEmailResults from mailman.queue import Runner NL = '\n' @@ -179,7 +179,12 @@ class CommandRunner(Runner): if command is None: print >> results, _('No such command: $command_name') else: - command.process(mlist, msg, msgdata, arguments, results) + status = command.process( + mlist, msg, msgdata, arguments, results) + assert status in ContinueProcessing, ( + 'Invalid status: %s' % status) + if status == ContinueProcessing.no: + break # All done, send the response. if len(finder.command_lines) > 0: print >> results, _('\n- Unprocessed:') diff --git a/mailman/queue/docs/command.txt b/mailman/queue/docs/command.txt index fdad3bb5c..06d2e2117 100644 --- a/mailman/queue/docs/command.txt +++ b/mailman/queue/docs/command.txt @@ -104,3 +104,68 @@ message is plain text. <BLANKLINE> - Done. <BLANKLINE> + + +Stopping command processing +--------------------------- + +The 'end' command stops email processing, so that nothing following is looked +at by the command queue. + + >>> msg = message_from_string("""\ + ... From: cperson@example.com + ... To: test-request@example.com + ... Message-ID: <caribou> + ... + ... echo foo bar + ... end ignored + ... echo baz qux + ... """) + + >>> inject_message(mlist, msg, qdir=config.CMDQUEUE_DIR) + >>> command.run() + >>> len(virgin_queue.files) + 1 + >>> item = get_queue_messages(virgin_queue)[0] + >>> print item.msg.as_string() + Subject: The results of your email commands + ... + <BLANKLINE> + - Results: + echo foo bar + <BLANKLINE> + - Unprocessed: + echo baz qux + <BLANKLINE> + - Done. + <BLANKLINE> + +The 'stop' command is an alias for 'end'. + + >>> msg = message_from_string("""\ + ... From: cperson@example.com + ... To: test-request@example.com + ... Message-ID: <caribou> + ... + ... echo foo bar + ... stop ignored + ... echo baz qux + ... """) + + >>> inject_message(mlist, msg, qdir=config.CMDQUEUE_DIR) + >>> command.run() + >>> len(virgin_queue.files) + 1 + >>> item = get_queue_messages(virgin_queue)[0] + >>> print item.msg.as_string() + Subject: The results of your email commands + ... + <BLANKLINE> + - Results: + echo foo bar + <BLANKLINE> + - Unprocessed: + echo baz qux + <BLANKLINE> + - Done. + <BLANKLINE> |
