From eb3ab8a8a6db0ffc8cddd07a89d5b603817864f5 Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Thu, 16 Dec 1999 17:12:31 +0000 Subject: Port to the new way of handling messages. Also we don't send email when the alias is misconfigured. This will just naturally happen in the error logs. --- scripts/mailcmd | 36 ++++++++++++++++++------------------ scripts/request | 36 ++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 36 deletions(-) (limited to 'scripts') diff --git a/scripts/mailcmd b/scripts/mailcmd index 34e77e300..6a8267677 100755 --- a/scripts/mailcmd +++ b/scripts/mailcmd @@ -26,30 +26,30 @@ Errors are redirected to logs/errors. import sys + import paths +from Mailman import mm_cfg from Mailman import MailList from Mailman import Utils - +from Mailman import Message +from Mailman.pythonlib.StringIO import StringIO from Mailman.Logging.Utils import LogStdErr -LogStdErr("error", "mailcmd") -# Only let one program run at once per list. +LogStdErr("error", "mailcmd") -if sys.argv[1] not in Utils.list_names(): - from Mailman import mm_cfg - Utils.SendTextToUser("Misconfigured list %s" % sys.argv[1], - ("List %s in aliases but not among " - "list_names?\n\n" - "---------- Forwarded message ----------\n" - "%s" - % (mm_cfg.MAILMAN_OWNER, sys.stdin.read())), - mm_cfg.MAILMAN_OWNER, - sender=mm_cfg.MAILMAN_OWNER) -list = MailList.MailList(sys.argv[1]) + +def main(): + # allow misconfigurations to be logged in logs/error + mlist = MailList.MailList(sys.argv[1]) + try: + s = StringIO(sys.stdin.read()) + msg = Message.Message(s) + mlist.ParseMailCommands(msg) + finally: + mlist.Save() + mlist.Unlock() -try: - list.ParseMailCommands() -finally: - list.Unlock() +if __name__ == '__main__': + main() diff --git a/scripts/request b/scripts/request index 34e77e300..6a8267677 100755 --- a/scripts/request +++ b/scripts/request @@ -26,30 +26,30 @@ Errors are redirected to logs/errors. import sys + import paths +from Mailman import mm_cfg from Mailman import MailList from Mailman import Utils - +from Mailman import Message +from Mailman.pythonlib.StringIO import StringIO from Mailman.Logging.Utils import LogStdErr -LogStdErr("error", "mailcmd") -# Only let one program run at once per list. +LogStdErr("error", "mailcmd") -if sys.argv[1] not in Utils.list_names(): - from Mailman import mm_cfg - Utils.SendTextToUser("Misconfigured list %s" % sys.argv[1], - ("List %s in aliases but not among " - "list_names?\n\n" - "---------- Forwarded message ----------\n" - "%s" - % (mm_cfg.MAILMAN_OWNER, sys.stdin.read())), - mm_cfg.MAILMAN_OWNER, - sender=mm_cfg.MAILMAN_OWNER) -list = MailList.MailList(sys.argv[1]) + +def main(): + # allow misconfigurations to be logged in logs/error + mlist = MailList.MailList(sys.argv[1]) + try: + s = StringIO(sys.stdin.read()) + msg = Message.Message(s) + mlist.ParseMailCommands(msg) + finally: + mlist.Save() + mlist.Unlock() -try: - list.ParseMailCommands() -finally: - list.Unlock() +if __name__ == '__main__': + main() -- cgit v1.2.3-70-g09d2