diff options
| author | bwarsaw | 2001-05-20 02:44:02 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-05-20 02:44:02 +0000 |
| commit | 830e5feb6cd0ae0e0758daf7fe610b53bb8597da (patch) | |
| tree | 56681be30b1e76807fb804c992c43039cd7ae2f5 | |
| parent | a92b60ee2107343bf12806415e886aa3308c3126 (diff) | |
| download | mailman-830e5feb6cd0ae0e0758daf7fe610b53bb8597da.tar.gz mailman-830e5feb6cd0ae0e0758daf7fe610b53bb8597da.tar.zst mailman-830e5feb6cd0ae0e0758daf7fe610b53bb8597da.zip | |
We don't need this script any more. To remove language support from a
list, simply "rm -rf lists/mylist/lang".
| -rw-r--r-- | bin/rmlang | 125 |
1 files changed, 0 insertions, 125 deletions
diff --git a/bin/rmlang b/bin/rmlang deleted file mode 100644 index a7ede096d..000000000 --- a/bin/rmlang +++ /dev/null @@ -1,125 +0,0 @@ -#! /usr/bin/env python -# -# Copyright (C) 2000,2001 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 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -"""Remove language[s] support to a mailing list. - -Usage: - - rmlang [options] code1 code2 ... - -Options: - - --help/-h - Print this message and exit. - - --listname=listname - -l listname - The name of the mailing list to remove the language support from. - -code must exist in list._template_dir as a directory. code corresponding to -mm_cfg.DEFAULT_SERVER_LANGUAGE can not be removed. -""" - -import sys -import os -import getopt - -import paths # path hacking -from Mailman import mm_cfg -from Mailman import Utils -from Mailman import MailList -from Mailman.HTMLFormatter import HTMLFormatter -from Mailman.i18n import _ - - - -def usage(code, msg=''): - print >> sys.stderr, _(__doc__) - if msg: - print >> sys.stderr, msg - sys.exit(code) - - - -def remove_it(listname, dir, msg): - if os.path.islink(dir): - print _('Removing'), msg - os.unlink(dir) - elif os.path.exists(dir): - print _('Removing'), msg - os.system('rm -rf ' + dir) - else: - print listname, msg, _('not found as'), dir - - - -def main(): - try: - opts, args = getopt.getopt(sys.argv[1:], 'l:h', - ['listname=', 'help']) - except getopt.error, msg: - usage(1, msg) - - listname = None - for opt, arg in opts: - if opt in ('-h', '--help'): - usage(0) - elif opt in ('-l', '--listname'): - listname = arg - - languages = args - if listname is None: - usage(1, _('--listname/-l is required')) - if not languages: - usage(1, _('no languages given')) - - listname = listname.lower() - try: - mlist = MailList.MailList(listname, lock=0) - except Errors.MMListError, e: - usage(1, _('No such list "%(listname)s"\n%(e)s')) - - try: - mlist.Lock(timeout=0.5) - except LockFile.TimeOutError: - usage(1, _("Could't acquire list lock, try again later: %(listname)s")) - - try: - # BAW: hmm... same question as with newlist - HTMLFormatter.InitVars(mlist) - - for lang in languages: - dir = os.path.join(mlist._template_dir, lang) - if lang == mm_cfg.DEFAULT_SERVER_LANGUAGE: - print >> sys.stderr, _('''\ -%(lang)s is the server default language and cannot be removed''') - continue - if not os.path.exists(dir): - print >> sys.stderr, _( - 'Language %(lang)s not supported by list: %(listname)s') - continue - - remove_it(listname, dir, _('language support for %(lang)s')) - finally: - mlist.Save() - mlist.Unlock() - - - -if __name__ == '__main__': - main() |
