1
# Copyright (C) 1998-2008 by the Free Software Foundation, Inc.
3
# This program is free software; you can redistribute it and/or
4
# modify it under the terms of the GNU General Public License
5
# as published by the Free Software Foundation; either version 2
6
# of the License, or (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22
from mailman import Errors
23
from mailman import Utils
24
from mailman.app.lifecycle import remove_list
25
from mailman.configuration import config
26
from mailman.i18n import _
27
from mailman.options import MultipleMailingListOptions
31
class ScriptOptions(MultipleMailingListOptions):
35
Remove the components of a mailing list with impunity - beware!
37
This removes (almost) all traces of a mailing list. By default, the lists
38
archives are not removed, which is very handy for retiring old lists.
41
def add_options(self):
42
super(ScriptOptions, self).add_options()
43
self.parser.add_option(
45
default=False, action='store_true',
47
Remove the list's archives too, or if the list has already been deleted,
48
remove any residual archives."""))
49
self.parser.add_option(
51
default=False, action='store_true',
52
help=_('Suppress status messages'))
54
def sanity_check(self):
55
if len(self.options.listnames) == 0:
56
self.parser.error(_('Nothing to do'))
57
if len(self.arguments) > 0:
58
self.parser.error(_('Unexpected arguments'))
63
options = ScriptOptions()
66
for fqdn_listname in options.options.listnames:
67
if not options.options.quiet:
68
print _('Removing list: $fqdn_listname')
69
mlist = config.db.list_manager.get(fqdn_listname)
71
if options.options.archives:
73
No such list: ${fqdn_listname}. Removing its residual archives.""")
75
print >> sys.stderr, _(
76
'No such list (or list already deleted): $fqdn_listname')
78
if not options.options.archives:
79
print _('Not removing archives. Reinvoke with -a to remove them.')
81
remove_list(fqdn_listname, mlist, options.options.archives)
86
if __name__ == '__main__':