aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorbwarsaw <>2003-04-20 04:02:13 +0000
committerbwarsaw <>2003-04-20 04:02:13 +0000
commit04192d3afe33bcfd72f64bacaab4e70c627268f3 (patch)
treeed48393d475c6ad099ab27d8f016fd15e788686d /bin
parent866b613202dd6b94091c7fec7a58d1878ec0f682 (diff)
downloadmailman2-04192d3afe33bcfd72f64bacaab4e70c627268f3.tar.gz
mailman2-04192d3afe33bcfd72f64bacaab4e70c627268f3.tar.xz
mailman2-04192d3afe33bcfd72f64bacaab4e70c627268f3.zip
Backporting from the trunk.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/add_members44
-rwxr-xr-xbin/rmlist71
2 files changed, 44 insertions, 71 deletions
diff --git a/bin/add_members b/bin/add_members
index 92b3ca04..1e50b941 100755
--- a/bin/add_members
+++ b/bin/add_members
@@ -41,11 +41,6 @@ Options:
-d file
Similar to above, but these people become digest members.
- --changes-msg=<y|n>
- -c <y|n>
- Set whether or not to send the list members the `there's going to be
- big changes to your list' message. defaults to no.
-
--welcome-msg=<y|n>
-w <y|n>
Set whether or not to send the list members a welcome message,
@@ -116,31 +111,6 @@ def readfile(filename):
-def SendExplanation(mlist, users):
- listname = mlist.real_name
- listhost = mlist.host_name
- d = {'listname' : listname,
- 'listhost' : listhost,
- 'listaddr' : mlist.GetListEmail(),
- 'listinfo_url': mlist.GetScriptURL('listinfo', absolute=1),
- 'requestaddr' : mlist.GetRequestEmail(),
- 'adminaddr' : mlist.GetOwnerEmail(),
- 'version' : mm_cfg.VERSION,
- }
- otrans = i18n.get_translation()
- i18n.set_language(mlist.preferred_language)
- try:
- text = Utils.maketext('convert.txt', d)
- subject = _('Big change in %(listname)s@%(listhost)s mailing list')
- msg = Message.UserNotification(users, mlist.GetBouncesEmail(),
- subject, text,
- mlist.preferred_language)
- finally:
- i18n.set_translation(otrans)
- msg.send(mlist)
-
-
-
class Tee:
def __init__(self, outfp):
self.__outfp = outfp
@@ -180,12 +150,11 @@ def addall(mlist, members, digest, ack, outfp):
def main():
try:
opts, args = getopt.getopt(sys.argv[1:],
- 'a:n:r:d:c:w:h',
+ 'a:n:r:d:w:h',
['admin-notify=',
'regular-members-file=',
'non-digest-members-file=',
'digest-members-file=',
- 'changes-msg=',
'welcome-msg=',
'help'])
except getopt.error, msg:
@@ -197,7 +166,6 @@ def main():
listname = args[0].lower().strip()
nfile = None
dfile = None
- send_changes_msg = 0
send_welcome_msg = None
admin_notif = None
for opt, arg in opts:
@@ -214,13 +182,6 @@ def main():
# I don't think we need to use the warnings module here.
print >> sys.stderr, 'option', opt, \
'is deprecated, use -r/--regular-members-file'
- elif opt in ('-c', '--changes-msg'):
- if arg.lower()[0] == 'y':
- send_changes_msg = 1
- elif arg.lower()[0] == 'n':
- send_changes_msg = 0
- else:
- usage(1, _('Bad argument to -c/--changes-msg: %(arg)s'))
elif opt in ('-w', '--welcome-msg'):
if arg.lower()[0] == 'y':
send_welcome_msg = 1
@@ -284,9 +245,6 @@ def main():
mlist.preferred_language)
msg.send(mlist)
- if send_changes_msg:
- SendExplanation(mlist, nmembers + dmembers)
-
mlist.Save()
finally:
mlist.Unlock()
diff --git a/bin/rmlist b/bin/rmlist
index 6ff0b5c1..2a7cd969 100755
--- a/bin/rmlist
+++ b/bin/rmlist
@@ -1,19 +1,19 @@
#! @PYTHON@
#
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-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
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
+# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""Remove the components of a mailing list with impunity - beware!
@@ -47,6 +47,12 @@ from Mailman import Utils
from Mailman import MailList
from Mailman.i18n import _
+try:
+ True, False
+except NameError:
+ True = 1
+ False = 0
+
def usage(code, msg=''):
@@ -61,15 +67,17 @@ def usage(code, msg=''):
-def remove_it(listname, dir, msg):
- if os.path.islink(dir):
+def remove_it(listname, filename, msg):
+ if os.path.islink(filename):
print _('Removing %(msg)s')
- os.unlink(dir)
- elif os.path.isdir(dir):
+ os.unlink(filename)
+ elif os.path.isdir(filename):
print _('Removing %(msg)s')
- shutil.rmtree(dir)
+ shutil.rmtree(filename)
+ elif os.path.isfile(filename):
+ os.unlink(filename)
else:
- print _('%(listname)s %(msg)s not found as %(dir)s')
+ print _('%(listname)s %(msg)s not found as %(filename)s')
@@ -84,18 +92,18 @@ def main():
usage(1)
listname = args[0].lower().strip()
- removeArchives = 0
+ removeArchives = False
for opt, arg in opts:
if opt in ('-a', '--archives'):
- removeArchives = 1
+ removeArchives = True
elif opt in ('-h', '--help'):
usage(0)
if not Utils.list_exists(listname):
- if not removeArchives:
- usage(1, _('No such list (or list already deleted): %(listname)s'))
- else:
- print _(
+ if not removeArchives:
+ usage(1, _('No such list (or list already deleted): %(listname)s'))
+ else:
+ print _(
'No such list: %(listname)s. Removing its residual archives.')
if not removeArchives:
@@ -104,27 +112,34 @@ def main():
REMOVABLES = []
if Utils.list_exists(listname):
- mlist = MailList.MailList(listname, lock=0)
+ mlist = MailList.MailList(listname, lock=0)
- # Do the MTA-specific list deletion tasks
- if mm_cfg.MTA:
- modname = 'Mailman.MTA.' + mm_cfg.MTA
- __import__(modname)
- sys.modules[modname].remove(mlist)
+ # Do the MTA-specific list deletion tasks
+ if mm_cfg.MTA:
+ modname = 'Mailman.MTA.' + mm_cfg.MTA
+ __import__(modname)
+ sys.modules[modname].remove(mlist)
- REMOVABLES = [
- (os.path.join('lists', listname), _('list info')),
+ REMOVABLES = [
+ (os.path.join('lists', listname), _('list info')),
]
+ # Remove any stale locks associated with the list
+ for filename in os.listdir(mm_cfg.LOCK_DIR):
+ fn_listname = filename.split('.')[0]
+ if fn_listname == listname:
+ REMOVABLES.append((os.path.join(mm_cfg.LOCK_DIR, filename),
+ _('stale lock file')))
+
if removeArchives:
REMOVABLES.extend([
- (os.path.join('archives', 'private', listname),
+ (os.path.join('archives', 'private', listname),
_('private archives')),
- (os.path.join('archives', 'private', listname + '.mbox'),
+ (os.path.join('archives', 'private', listname + '.mbox'),
_('private archives')),
- (os.path.join('archives', 'public', listname),
+ (os.path.join('archives', 'public', listname),
_('public archives')),
- (os.path.join('archives', 'public', listname + '.mbox'),
+ (os.path.join('archives', 'public', listname + '.mbox'),
_('public archives')),
])