diff options
| author | bwarsaw | 2001-02-15 22:27:10 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-02-15 22:27:10 +0000 |
| commit | 6c2b0fc2cff29d035749b6cd63bde1e2dd7e6c74 (patch) | |
| tree | 98e38d23eccc22a42001a93bee83af600ec1882d | |
| parent | 844dbf717cda5d9788ff21e489e28d11bbac546b (diff) | |
| download | mailman-6c2b0fc2cff29d035749b6cd63bde1e2dd7e6c74.tar.gz mailman-6c2b0fc2cff29d035749b6cd63bde1e2dd7e6c74.tar.zst mailman-6c2b0fc2cff29d035749b6cd63bde1e2dd7e6c74.zip | |
| -rw-r--r-- | contrib/auto | 11 | ||||
| -rw-r--r-- | scripts/auto | 11 | ||||
| -rwxr-xr-x | scripts/post | 56 |
3 files changed, 22 insertions, 56 deletions
diff --git a/contrib/auto b/contrib/auto index 2d4374660..cb0c8d461 100644 --- a/contrib/auto +++ b/contrib/auto @@ -1,6 +1,6 @@ #! /usr/bin/env python # -# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc. +# Copyright (C) 2000,2001 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -32,10 +32,9 @@ import paths from Mailman import mm_cfg from Mailman import Utils from Mailman import MailList -from Mailman import Message from Mailman import Errors +from Mailman.Queue.sbcache import get_switchboard from Mailman.Logging.Utils import LogStdErr -from Mailman.Logging.Syslog import syslog # Error code if it's really not a Mailman list addr destination EX_NOUSER = 67 @@ -101,10 +100,8 @@ def main(): print >> sys.stderr, 'Bad sub-destination:', extension return EX_NOUSER - # Get the message from standard input - msg = Message.Message(sys.stdin) - msg.Enqueue(mlist, **{subdest: 1}) - # success + inq = get_switchboard(mm_cfg.INQUEUE_DIR) + inq.enqueue(sys.stdin.read(), listname=listname, **{subdest: 1}) return 0 diff --git a/scripts/auto b/scripts/auto index 2d4374660..cb0c8d461 100644 --- a/scripts/auto +++ b/scripts/auto @@ -1,6 +1,6 @@ #! /usr/bin/env python # -# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc. +# Copyright (C) 2000,2001 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -32,10 +32,9 @@ import paths from Mailman import mm_cfg from Mailman import Utils from Mailman import MailList -from Mailman import Message from Mailman import Errors +from Mailman.Queue.sbcache import get_switchboard from Mailman.Logging.Utils import LogStdErr -from Mailman.Logging.Syslog import syslog # Error code if it's really not a Mailman list addr destination EX_NOUSER = 67 @@ -101,10 +100,8 @@ def main(): print >> sys.stderr, 'Bad sub-destination:', extension return EX_NOUSER - # Get the message from standard input - msg = Message.Message(sys.stdin) - msg.Enqueue(mlist, **{subdest: 1}) - # success + inq = get_switchboard(mm_cfg.INQUEUE_DIR) + inq.enqueue(sys.stdin.read(), listname=listname, **{subdest: 1}) return 0 diff --git a/scripts/post b/scripts/post index 75ac17c25..44fc1ac2f 100755 --- a/scripts/post +++ b/scripts/post @@ -1,6 +1,6 @@ #! /usr/bin/env python # -# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc. +# Copyright (C) 1998,1999,2000,2001 by the Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -30,35 +30,14 @@ import sys import paths from Mailman import mm_cfg -from Mailman import MailList -from Mailman import Message -from Mailman import Errors +from Mailman import Utils +from Mailman.Queue.sbcache import get_switchboard from Mailman.Logging.Utils import LogStdErr -from Mailman.pythonlib.StringIO import StringIO LogStdErr("error", "post") -def get_message(mlist): - msg = None - # Perhaps flow the message text through a filter program - prog = mlist.filter_prog - if prog: - import os, __main__ - file = os.path.join(mm_cfg.VAR_PREFIX, 'filters', prog) - try: - execfile(file) - msg = Message.Message(StringIO(__main__.mailman_text)) - except: - pass - if msg is None: - s = StringIO(sys.stdin.read()) - msg = Message.Message(s) - return msg - - - def main(): # TBD: If you've configured your list or aliases so poorly as to get # either of these first two errors, there's little that can be done to @@ -67,26 +46,19 @@ def main(): try: listname = sys.argv[1] except IndexError: - sys.stderr.write('Mailman error: post got no listname.\n') + print >> sys.stderr, _('post script got no listname.') sys.exit(1) - try: - mlist = MailList.MailList(listname, lock=0) - except Errors.MMListError, e: - sys.stderr.write('Mailman error: post got bad listname: %s\n%s' % - (listname, e)) + # Make sure the list exists + if not Utils.list_exists(listname): + print >> sys.stderr, _('post script, list not found: %(listname)s') sys.exit(1) - # We have a valid, unlocked list. This is enough to extract the message - # object in a usable form. From here on out, we should never lose - # messages. - msg = get_message(mlist) - # Immediately queue the message for the qrunner to deliver, mostly likely - # about a minute from now. The advantage to this approach is that - # messages should never get lost -- some MTAs have a hard limit to the - # time a filter prog can run. Postfix is a good example; if the limit is - # hit, the proc is SIGKILL'd giving us no chance to save the message. It - # could take a long time to acquire the lock. This way we're fairly safe - # against catastrophe at the expense of more disk I/O. - msg.Enqueue(mlist, tolist=1, _whichq=mm_cfg.INQUEUE_DIR) + # Immediately queue the message for the incoming qrunner to process. The + # advantage to this approach is that messages should never get lost -- + # some MTAs have a hard limit to the time a filter prog can run. Postfix + # is a good example; if the limit is hit, the proc is SIGKILL'd giving us + # no chance to save the message. + inq = get_switchboard(mm_cfg.INQUEUE_DIR) + inq.enqueue(sys.stdin.read(), listname=listname, tolist=1) |
