aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/MTA
diff options
context:
space:
mode:
authorbwarsaw <>2003-03-31 21:49:43 +0000
committerbwarsaw <>2003-03-31 21:49:43 +0000
commitde777e10950eed3aff489e74908578b5759003bb (patch)
tree10711cb2e58ce6b83faf021b0cd084de58d22bc4 /Mailman/MTA
parentfb97bfb122d119977a719f3a33673edaaae5bd37 (diff)
downloadmailman2-de777e10950eed3aff489e74908578b5759003bb.tar.gz
mailman2-de777e10950eed3aff489e74908578b5759003bb.tar.xz
mailman2-de777e10950eed3aff489e74908578b5759003bb.zip
Backporting from trunk
Diffstat (limited to 'Mailman/MTA')
-rw-r--r--Mailman/MTA/Manual.py23
-rw-r--r--Mailman/MTA/Postfix.py34
2 files changed, 36 insertions, 21 deletions
diff --git a/Mailman/MTA/Manual.py b/Mailman/MTA/Manual.py
index dd9127cc..db4161e0 100644
--- a/Mailman/MTA/Manual.py
+++ b/Mailman/MTA/Manual.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 2001-2003 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
@@ -26,6 +26,12 @@ from Mailman.Queue.sbcache import get_switchboard
from Mailman.i18n import _
from Mailman.MTA.Utils import makealiases
+try:
+ True, False
+except NameError:
+ True = 1
+ False = 0
+
# no-ops for interface compliance
@@ -33,7 +39,7 @@ def makelock():
class Dummy:
def lock(self):
pass
- def unlock(self, unconditionally=0):
+ def unlock(self, unconditionally=False):
pass
return Dummy()
@@ -44,7 +50,7 @@ def clear():
# nolock argument is ignored, but exists for interface compliance
-def create(mlist, cgi=0, nolock=0):
+def create(mlist, cgi=False, nolock=False, quiet=False):
if mlist is None:
return
listname = mlist.internal_name()
@@ -54,7 +60,8 @@ def create(mlist, cgi=0, nolock=0):
# an email message to mailman-owner requesting that the proper aliases
# be installed.
sfp = StringIO()
- print >> sfp, _("""\
+ if not quiet:
+ print >> sfp, _("""\
The mailing list `%(listname)s' has been created via the through-the-web
interface. In order to complete the activation of this mailing list, the
proper /etc/aliases (or equivalent) file must be updated. The program
@@ -64,11 +71,13 @@ Here are the entries for the /etc/aliases file:
""")
outfp = sfp
else:
- print _("""
+ if not quiet:
+ print _("""\
To finish creating your mailing list, you must edit your /etc/aliases (or
equivalent) file by adding the following lines, and possibly running the
`newaliases' program:
-
+""")
+ print _("""\
## %(listname)s mailing list""")
outfp = sys.stdout
# Common path
@@ -92,7 +101,7 @@ equivalent) file by adding the following lines, and possibly running the
-def remove(mlist, cgi=0):
+def remove(mlist, cgi=False):
listname = mlist.internal_name()
fieldsz = len(listname) + len('-unsubscribe')
if cgi:
diff --git a/Mailman/MTA/Postfix.py b/Mailman/MTA/Postfix.py
index 84718e5f..929ed1b5 100644
--- a/Mailman/MTA/Postfix.py
+++ b/Mailman/MTA/Postfix.py
@@ -18,10 +18,10 @@
"""
import os
-import time
-import errno
import pwd
import grp
+import time
+import errno
from stat import *
from Mailman import mm_cfg
@@ -35,6 +35,12 @@ LOCKFILE = os.path.join(mm_cfg.LOCK_DIR, 'creator')
ALIASFILE = os.path.join(mm_cfg.DATA_DIR, 'aliases')
VIRTFILE = os.path.join(mm_cfg.DATA_DIR, 'virtual-mailman')
+try:
+ True, False
+except NameError:
+ True = 1
+ False = 0
+
def _update_maps():
@@ -160,7 +166,7 @@ def _check_for_virtual_loopaddr(mlist, filename):
os.umask(omask)
try:
# Find the start of the loop address block
- while 1:
+ while True:
line = infp.readline()
if not line:
break
@@ -168,7 +174,7 @@ def _check_for_virtual_loopaddr(mlist, filename):
if line.startswith('# LOOP ADDRESSES START'):
break
# Now see if our domain has already been written
- while 1:
+ while True:
line = infp.readline()
if not line:
break
@@ -212,8 +218,8 @@ def _do_create(mlist, textfile, func):
_check_for_virtual_loopaddr(mlist, textfile)
-def create(mlist, cgi=0, nolock=0):
- # Acquire the global list database lock
+def create(mlist, cgi=False, nolock=False, quiet=False):
+ # Acquire the global list database lock. quiet flag is ignored.
lock = None
if not nolock:
lock = makelock()
@@ -226,7 +232,7 @@ def create(mlist, cgi=0, nolock=0):
_update_maps()
finally:
if lock:
- lock.unlock(unconditionally=1)
+ lock.unlock(unconditionally=True)
@@ -247,7 +253,7 @@ def _do_remove(mlist, textfile, virtualp):
outfp = open(textfile + '.tmp', 'w')
finally:
os.umask(omask)
- filteroutp = 0
+ filteroutp = False
start = '# STANZA START: ' + listname
end = '# STANZA END: ' + listname
while 1:
@@ -260,7 +266,7 @@ def _do_remove(mlist, textfile, virtualp):
# marker.
if filteroutp:
if line.strip() == end:
- filteroutp = 0
+ filteroutp = False
# Discard the trailing blank line, but don't worry if
# we're at the end of the file.
infp.readline()
@@ -268,7 +274,7 @@ def _do_remove(mlist, textfile, virtualp):
else:
if line.strip() == start:
# Filter out this stanza
- filteroutp = 1
+ filteroutp = True
else:
outfp.write(line)
# Close up shop, and rotate the files
@@ -278,18 +284,18 @@ def _do_remove(mlist, textfile, virtualp):
os.rename(textfile+'.tmp', textfile)
-def remove(mlist, cgi=0):
+def remove(mlist, cgi=False):
# Acquire the global list database lock
lock = makelock()
lock.lock()
try:
- _do_remove(mlist, ALIASFILE, 0)
+ _do_remove(mlist, ALIASFILE, False)
if mlist.host_name in mm_cfg.POSTFIX_STYLE_VIRTUAL_DOMAINS:
- _do_remove(mlist, VIRTFILE, 1)
+ _do_remove(mlist, VIRTFILE, True)
# Regenerate the alias and map files
_update_maps()
finally:
- lock.unlock(unconditionally=1)
+ lock.unlock(unconditionally=True)