diff options
| author | bwarsaw | 2001-05-21 18:23:53 +0000 |
|---|---|---|
| committer | bwarsaw | 2001-05-21 18:23:53 +0000 |
| commit | fe79c385dc6fa2eb137dfb1a72f8e95dae643435 (patch) | |
| tree | aad450fdd27c32d725bced6412ed20f2d6d0d834 | |
| parent | e56b420c5a85bdbd0b7d2cbb8adb0abebfbe2688 (diff) | |
| download | mailman-fe79c385dc6fa2eb137dfb1a72f8e95dae643435.tar.gz mailman-fe79c385dc6fa2eb137dfb1a72f8e95dae643435.tar.zst mailman-fe79c385dc6fa2eb137dfb1a72f8e95dae643435.zip | |
| -rw-r--r-- | bin/newlang | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/bin/newlang b/bin/newlang deleted file mode 100644 index 3a3308042..000000000 --- a/bin/newlang +++ /dev/null @@ -1,120 +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. - -"""Add language[s] support to a mailing list. - -Usage: - - newlang [options] [lang1 [lang2 ...]] - -Options: - - --help/-h - Print this message and exit. - - --listname=listname - -l listname - The name of the mailing list to add the language support to. This is - a required option. - -lang is the corresponding language directory and must exist in -mm_cfg.TEMPLATES. If no lang is given on the command line, the server's -default language is used. -""" - -import sys -import os -import getopt - -import paths # path hacking -from Mailman import mm_cfg -from Mailman import Utils -from Mailman import Errors -from Mailman import MailList -from Mailman import LockFile -from Mailman.i18n import _ - -COMMASPACE = ', ' - - - -def usage(code, msg=''): - print >> sys.stderr, _(__doc__) - if msg: - print >> sys.stderr, msg - sys.exit(code) - - - -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: - languages = [mm_cfg.DEFAULT_SERVER_LANGUAGE] - - listname = listname.lower() - try: - mlist = MailList.MailList(listname, lock=0) - except Errors.MMListError, e: - usage(1, _('No such list "%(listname)s"\n%(e)s')) - - # We only need to create the language subdirectory in order to make the - # list support this language. Note that unless the list owner - # specifically wants to specialize their templates, the global defaults - # for the given language will work just fine. - ok_langs = [] - for lang in languages: - gtemplatesdir = os.path.join(mm_cfg.TEMPLATE_DIR, lang) - if not os.path.isdir(gtemplatesdir): - print >> sys.stderr, _( - 'No template directory for language: %(dir)s') - continue - ltemplatesdir = os.path.join(mlist.fullpath(), lang) - omask = os.umask(0) - try: - try: - os.mkdir(ltemplatesdir, 02775) - ok_langs.append(lang) - except OSError, e: - if e.errno <> errno.EEXIST: raise - print >> sys.stderr, _( - 'List already supports language: %(lang)s') - finally: - os.umask(omask) - - # All done - okmsg = COMMASPACE.join(ok_langs) - print _('Language support for %(okmsg)s added') - - - -if __name__ == '__main__': - main() |
