summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw1998-05-26 18:50:21 +0000
committerbwarsaw1998-05-26 18:50:21 +0000
commit7855ac178dbe79168975f7a485a7aa76dc5c9380 (patch)
tree6fd62fe22c4a8271fb555c39114125e3caafc09f
parentf20768771d749836f1b5b285a22fdcb23b0c2054 (diff)
downloadmailman-7855ac178dbe79168975f7a485a7aa76dc5c9380.tar.gz
mailman-7855ac178dbe79168975f7a485a7aa76dc5c9380.tar.zst
mailman-7855ac178dbe79168975f7a485a7aa76dc5c9380.zip
1. Use the standard Python invocation #! line to get the interpreter
from $PATH 2. Do no direct sys.path munging in this file. Import the `paths' module, which is created during the configure process, and which performs all necessary path munging (and exports some useful variables too). 3. Remove RCS crud Also: Removed all hardcoded absolute paths. Instead, calculate paths using paths.prefix as the base. Change ''' TQS to """ so as not to confuse font-lock. !!!! When calling SendTextToUser(), set the new optional argument raw=1 so that the text body will not be wrapped/filled. The checkin that implements wrapping and filling has not yet been made. Note that it would be nice if just the templated text could be wrapped/filled and the err_msg left alone, but that's currently too hard to separate.
-rwxr-xr-xscripts/post17
1 files changed, 8 insertions, 9 deletions
diff --git a/scripts/post b/scripts/post
index 964c71a75..4b73c84a6 100755
--- a/scripts/post
+++ b/scripts/post
@@ -1,4 +1,5 @@
-#! /usr/local/bin/python
+#! /usr/bin/env python
+#
# Copyright (C) 1998 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
@@ -22,15 +23,12 @@ This script is invoked via the mail wrapper.
Stdin is the mail message, and argv[1] is the name of the target mailing
list."""
-__version__ = "$Revision: 547 $"
# Todo: check size of To: list < 100
# Send back why the post was rejected.
import sys
-
-sys.path.append('/home/mailman/mailman/modules')
-
+import paths
import maillist, mm_message, mm_err, mm_cfg, mm_utils
try:
@@ -48,7 +46,7 @@ try:
prog = current_list.filter_prog
if prog:
import os, __main__
- file = os.path.join('/home/mailman/mailman/filters', prog)
+ file = os.path.join(paths.prefix, 'filters', prog)
try:
execfile(file)
text = __main__.mailman_text
@@ -74,7 +72,7 @@ try:
subj = msg.getheader('subject')
if not subj:
subj = '[no subject]'
- body = '''
+ body = """
Your mail to '%s' with the subject:
%s
@@ -87,12 +85,13 @@ The reason it is being held:
Either the message will get posted to the list, or you will receive
notification of the moderator's decison.
-''' % (current_list.real_name, subj, err_msg)
+""" % (current_list.real_name, subj, err_msg)
current_list.SendTextToUser( subject = 'Mail sent to %s' %
current_list.real_name,
recipient = the_sender,
- text = body)
+ text = body,
+ raw = 1)
# Let another process run.
finally:
current_list.Unlock()