From 6a6f712fc9efadbc677e97aa63e1fcf83372e2ee Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Wed, 9 May 2001 15:04:15 +0000 Subject: Added support for through-the-web list deletion. Also, remove_it(): Use the new Utils.rmdirhier() function instead of calling 'rm -r' through os.system(). main(): Create the MailList object (unlocked) which is passed to the MTA-specific remove() function. Also, use a better idiom for extending the REMOVABLES variable. --- bin/rmlist | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/bin/rmlist b/bin/rmlist index dc8091ecc..44e61be0f 100755 --- a/bin/rmlist +++ b/bin/rmlist @@ -42,6 +42,7 @@ import getopt import paths from Mailman import mm_cfg from Mailman import Utils +from Mailman import MailList from Mailman.i18n import _ @@ -58,9 +59,9 @@ def remove_it(listname, dir, msg): if os.path.islink(dir): print _('Removing %(msg)s') os.unlink(dir) - elif os.path.exists(dir): + elif os.path.isdir(dir): print _('Removing %(msg)s') - os.system('rm -rf ' + dir) + Utils.rmdirhier(dir) else: print _('%(listname)s %(msg)s not found as %(dir)s') @@ -80,6 +81,8 @@ def main(): if not Utils.list_exists(listname): usage(1, _('No such list: %(listname)s')) + mlist = MailList.MailList(listname, lock=0) + removeArchives = 0 for opt, arg in opts: if opt in ('-a', '--archives'): @@ -90,16 +93,22 @@ def main(): if not removeArchives: print _('Not removing archives. Reinvoke with -a to remove them.') + # 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 = [('lists/%s', 'list info'), ] if removeArchives: - REMOVABLES = REMOVABLES + \ - [('archives/private/%s', _('private archives')), - ('archives/private/%s.mbox', _('private archives')), - ('archives/public/%s', _('public archives')), - ('archives/public/%s.mbox', _('public archives')), - ] + REMOVABLES.extend( + [('archives/private/%s', _('private archives')), + ('archives/private/%s.mbox', _('private archives')), + ('archives/public/%s', _('public archives')), + ('archives/public/%s.mbox', _('public archives')), + ]) for dirtmpl, msg in REMOVABLES: dir = os.path.join(mm_cfg.VAR_PREFIX, dirtmpl % listname) -- cgit v1.3.1