diff options
| author | bwarsaw | 2006-09-25 00:01:06 +0000 |
|---|---|---|
| committer | bwarsaw | 2006-09-25 00:01:06 +0000 |
| commit | 8157935353a960cd03a72e403e8638b016c8e9a1 (patch) | |
| tree | 00e219530cab575a9d2ec76ee9c90523d14a5275 | |
| parent | 99a4f0ef16e6dfddafbd396896afb97821528f16 (diff) | |
| download | mailman-8157935353a960cd03a72e403e8638b016c8e9a1.tar.gz mailman-8157935353a960cd03a72e403e8638b016c8e9a1.tar.zst mailman-8157935353a960cd03a72e403e8638b016c8e9a1.zip | |
| -rw-r--r-- | Mailman/Cgi/create.py | 4 | ||||
| -rw-r--r-- | Mailman/MTA/Manual.py | 34 | ||||
| -rw-r--r-- | Mailman/MTA/Postfix.py | 28 | ||||
| -rw-r--r-- | Mailman/MailList.py | 9 | ||||
| -rwxr-xr-x | Mailman/bin/check_perms.py | 12 | ||||
| -rw-r--r-- | Mailman/bin/genaliases.py (renamed from bin/genaliases) | 86 | ||||
| -rw-r--r-- | Mailman/bin/mmsitepass.py | 8 | ||||
| -rw-r--r-- | bin/Makefile.in | 10 | ||||
| -rw-r--r-- | bin/withlist | 3 | ||||
| -rwxr-xr-x | configure | 3 | ||||
| -rw-r--r-- | configure.in | 3 |
11 files changed, 87 insertions, 113 deletions
diff --git a/Mailman/Cgi/create.py b/Mailman/Cgi/create.py index 33236ad25..9a5ab73d8 100644 --- a/Mailman/Cgi/create.py +++ b/Mailman/Cgi/create.py @@ -79,7 +79,7 @@ def process_request(doc, cgidata): listname = cgidata.getvalue('listname', '').strip().lower() owner = cgidata.getvalue('owner', '').strip() try: - autogen = bool(cgidata.getvalue('autogen', '0')) + autogen = bool(int(cgidata.getvalue('autogen', '0'))) except ValueError: autogen = False try: @@ -319,7 +319,7 @@ def request_creation(doc, cgidata=dummy, errmsg=None): ftable.AddCellInfo(ftable.GetCurrentRowIndex(), 1, bgcolor=GREY) try: - autogen = bool(cgidata.getvalue('autogen', '0')) + autogen = bool(int(cgidata.getvalue('autogen', '0'))) except ValueError: autogen = False ftable.AddRow([Label(_('Auto-generate initial list password?')), diff --git a/Mailman/MTA/Manual.py b/Mailman/MTA/Manual.py index d49327765..b406eab21 100644 --- a/Mailman/MTA/Manual.py +++ b/Mailman/MTA/Manual.py @@ -24,11 +24,13 @@ from cStringIO import StringIO from Mailman import Message from Mailman import Utils -from Mailman import mm_cfg from Mailman.MTA.Utils import makealiases from Mailman.Queue.sbcache import get_switchboard +from Mailman.configuration import config from Mailman.i18n import _ +__i18n_templates__ = True + # no-ops for interface compliance @@ -59,10 +61,10 @@ def create(mlist, cgi=False, nolock=False, quiet=False): sfp = StringIO() if not quiet: print >> sfp, _("""\ -The mailing list `%(listname)s' has been created via the through-the-web +The mailing list '$listname' has been created via the through-the-web interface. In order to complete the activation of this mailing list, the proper /etc/aliases (or equivalent) file must be updated. The program -`newaliases' may also have to be run. +'newaliases' may also have to be run. Here are the entries for the /etc/aliases file: """) @@ -72,10 +74,10 @@ Here are the entries for the /etc/aliases file: print _("""\ To finish creating your mailing list, you must edit your /etc/aliases (or equivalent) file by adding the following lines, and possibly running the -`newaliases' program: +'newaliases' program: """) print _("""\ -## %(listname)s mailing list""") +## $listname mailing list""") outfp = sys.stdout # Common path for k, v in makealiases(mlist): @@ -89,8 +91,8 @@ equivalent) file by adding the following lines, and possibly running the # Should this be sent in the site list's preferred language? msg = Message.UserNotification( siteowner, siteowner, - _('Mailing list creation request for list %(listname)s'), - sfp.getvalue(), mm_cfg.DEFAULT_SERVER_LANGUAGE) + _('Mailing list creation request for list $listname'), + sfp.getvalue(), config.DEFAULT_SERVER_LANGUAGE) msg.send(mlist) @@ -104,10 +106,10 @@ def remove(mlist, cgi=False): # aliases be deleted. sfp = StringIO() print >> sfp, _("""\ -The mailing list `%(listname)s' has been removed via the through-the-web +The mailing list '$listname' has been removed via the through-the-web interface. In order to complete the de-activation of this mailing list, the appropriate /etc/aliases (or equivalent) file must be updated. The program -`newaliases' may also have to be run. +'newaliases' may also have to be run. Here are the entries in the /etc/aliases file that should be removed: """) @@ -116,9 +118,9 @@ Here are the entries in the /etc/aliases file that should be removed: print _(""" To finish removing your mailing list, you must edit your /etc/aliases (or equivalent) file by removing the following lines, and possibly running the -`newaliases' program: +'newaliases' program: -## %(listname)s mailing list""") +## $listname mailing list""") outfp = sys.stdout # Common path for k, v in makealiases(mlist): @@ -132,8 +134,8 @@ equivalent) file by removing the following lines, and possibly running the # Should this be sent in the site list's preferred language? msg = Message.UserNotification( siteowner, siteowner, - _('Mailing list removal request for list %(listname)s'), - sfp.getvalue(), mm_cfg.DEFAULT_SERVER_LANGUAGE) - msg['Date'] = email.Utils.formatdate(localtime=1) - outq = get_switchboard(mm_cfg.OUTQUEUE_DIR) - outq.enqueue(msg, recips=[siteowner], nodecorate=1) + _('Mailing list removal request for list $listname'), + sfp.getvalue(), config.DEFAULT_SERVER_LANGUAGE) + msg['Date'] = email.Utils.formatdate(localtime=True) + outq = get_switchboard(config.OUTQUEUE_DIR) + outq.enqueue(msg, recips=[siteowner], nodecorate=True) diff --git a/Mailman/MTA/Postfix.py b/Mailman/MTA/Postfix.py index 9f7b52d50..51634ddf4 100644 --- a/Mailman/MTA/Postfix.py +++ b/Mailman/MTA/Postfix.py @@ -27,14 +27,14 @@ import logging from stat import * from Mailman import LockFile -from Mailman import mm_cfg from Mailman import Utils -from Mailman.i18n import _ from Mailman.MTA.Utils import makealiases +from Mailman.configuration import config +from Mailman.i18n import _ -LOCKFILE = os.path.join(mm_cfg.LOCK_DIR, 'creator') -ALIASFILE = os.path.join(mm_cfg.DATA_DIR, 'aliases') -VIRTFILE = os.path.join(mm_cfg.DATA_DIR, 'virtual-mailman') +LOCKFILE = os.path.join(config.LOCK_DIR, 'creator') +ALIASFILE = os.path.join(config.DATA_DIR, 'aliases') +VIRTFILE = os.path.join(config.DATA_DIR, 'virtual-mailman') log = logging.getLogger('mailman.error') @@ -42,14 +42,14 @@ log = logging.getLogger('mailman.error') def _update_maps(): msg = 'command failed: %s (status: %s, %s)' - acmd = mm_cfg.POSTFIX_ALIAS_CMD + ' ' + ALIASFILE + acmd = config.POSTFIX_ALIAS_CMD + ' ' + ALIASFILE status = (os.system(acmd) >> 8) & 0xff if status: errstr = os.strerror(status) log.error(msg, acmd, status, errstr) raise RuntimeError(msg % (acmd, status, errstr)) if os.path.exists(VIRTFILE): - vcmd = mm_cfg.POSTFIX_MAP_CMD + ' ' + VIRTFILE + vcmd = config.POSTFIX_MAP_CMD + ' ' + VIRTFILE status = (os.system(vcmd) >> 8) & 0xff if status: errstr = os.strerror(status) @@ -79,7 +79,7 @@ def clear(): def _addlist(mlist, fp): # Set up the mailman-loop address loopaddr = Utils.ParseEmail(Utils.get_site_noreply())[0] - loopmbox = os.path.join(mm_cfg.DATA_DIR, 'owner-bounces.mbox') + loopmbox = os.path.join(config.DATA_DIR, 'owner-bounces.mbox') # Seek to the end of the text file, but if it's empty write the standard # disclaimer, and the loop catch address. fp.seek(0, 2) @@ -104,7 +104,7 @@ def _addlist(mlist, fp): print >> fp, '# STANZA START:', listname print >> fp, '# CREATED:', time.ctime(time.time()) # Now add all the standard alias entries - for k, v in makealiases(listname): + for k, v in makealiases(mlist): # Format the text file nicely print >> fp, k + ':', ((fieldsz - len(k)) * ' ') + v # Finish the text file stanza @@ -141,7 +141,7 @@ def _addvirtual(mlist, fp): print >> fp, '# STANZA START:', listname print >> fp, '# CREATED:', time.ctime(time.time()) # Now add all the standard alias entries - for k, v in makealiases(listname): + for k, v in makealiases(mlist): # Format the text file nicely print >> fp, mlist.fqdn_listname, ((fieldsz - len(k)) * ' '), k # Finish the text file stanza @@ -223,7 +223,7 @@ def create(mlist, cgi=False, nolock=False, quiet=False): # Do the aliases file, which need to be done in any case try: _do_create(mlist, ALIASFILE, _addlist) - if mlist and mlist.host_name in mm_cfg.POSTFIX_STYLE_VIRTUAL_DOMAINS: + if mlist and mlist.host_name in config.POSTFIX_STYLE_VIRTUAL_DOMAINS: _do_create(mlist, VIRTFILE, _addvirtual) _update_maps() finally: @@ -286,7 +286,7 @@ def remove(mlist, cgi=False): lock.lock() try: _do_remove(mlist, ALIASFILE, False) - if mlist.host_name in mm_cfg.POSTFIX_STYLE_VIRTUAL_DOMAINS: + if mlist.host_name in config.POSTFIX_STYLE_VIRTUAL_DOMAINS: _do_remove(mlist, VIRTFILE, True) # Regenerate the alias and map files _update_maps() @@ -328,7 +328,7 @@ def checkperms(state): continue if state.VERBOSE: print _('checking ownership of %(dbfile)s') - user = mm_cfg.MAILMAN_USER + user = config.MAILMAN_USER ownerok = stat[ST_UID] == pwd.getpwnam(user)[2] if not ownerok: try: @@ -340,7 +340,7 @@ def checkperms(state): if state.FIX: print _('(fixing)') uid = pwd.getpwnam(user)[2] - gid = grp.getgrnam(mm_cfg.MAILMAN_GROUP)[2] + gid = grp.getgrnam(config.MAILMAN_GROUP)[2] os.chown(dbfile, uid, gid) else: print diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 89ace8565..9fa5806de 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -286,15 +286,14 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin, os.path.join(config.LOCK_DIR, name or '<site>') + '.lock', lifetime=config.LIST_LOCK_LIFETIME) # XXX FIXME Sometimes name is fully qualified, sometimes it's not. - if name and '@' in name: + if '@' in name: self._internal_name, self.host_name = name.split('@', 1) + self._full_path = os.path.join(config.LIST_DATA_DIR, name) else: self._internal_name = name self.host_name = config.DEFAULT_EMAIL_HOST - if name: - self._full_path = os.path.join(config.LIST_DATA_DIR, name) - else: - self._full_path = '' + self._full_path = os.path.join(config.LIST_DATA_DIR, + self.host_name + '@' + name) # Only one level of mixin inheritance allowed for baseclass in self.__class__.__bases__: if hasattr(baseclass, 'InitTempVars'): diff --git a/Mailman/bin/check_perms.py b/Mailman/bin/check_perms.py index c56171b49..0e5124b91 100755 --- a/Mailman/bin/check_perms.py +++ b/Mailman/bin/check_perms.py @@ -15,15 +15,6 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, # USA. -"""Check the permissions for the Mailman installation. - -Usage: %(PROGRAM)s [-f] [-v] [-h] - -With no arguments, just check and report all the files that have bogus -permissions or group ownership. With -f (and run as root), fix all the -permission problems found. With -v be verbose. -""" - import os import sys import pwd @@ -359,8 +350,7 @@ def parseargs(): Check the permissions of all Mailman files. With no options, just report the permission and ownership problems found.""")) parser.add_option('-f', '--fix', - default=False, action='store_true', - help=_("""\ + default=False, action='store_true', help=_("""\ Fix all permission and ownership problems found. With this option, you must run check_perms as root.""")) parser.add_option('-v', '--verbose', diff --git a/bin/genaliases b/Mailman/bin/genaliases.py index 18b67efe2..379b4bd94 100644 --- a/bin/genaliases +++ b/Mailman/bin/genaliases.py @@ -1,6 +1,6 @@ #! @PYTHON@ # -# Copyright (C) 2001-2003 by the Free Software Foundation, Inc. +# Copyright (C) 2001-2006 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 @@ -14,73 +14,51 @@ # # 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -"""Regenerate Mailman specific aliases from scratch. - -The actual output depends on the value of the `MTA' variable in your mm_cfg.py -file. - -Usage: genaliases [options] -Options: - - -q/--quiet - Some MTA output can include more verbose help text. Use this to tone - down the verbosity. - - -h/--help - Print this message and exit. -""" +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. import os import sys -import getopt +import optparse -import paths # path hacking -from Mailman import mm_cfg -from Mailman import Utils from Mailman import MailList +from Mailman import Utils +from Mailman import Version +from Mailman.configuration import config from Mailman.i18n import _ -try: - True, False -except NameError: - True = 1 - False = 0 +__i18n_templates__ = True -def usage(code, msg=''): - if code: - fd = sys.stderr - else: - fd = sys.stdout - print >> fd, _(__doc__) - if msg: - print >> fd, msg - sys.exit(code) +def parseargs(): + parser = optparse.OptionParser(version=Version.MAILMAN_VERSION, + usage=_("""\ +%prog [options] + +Regenerate the Mailman specific MTA aliases from scratch. The actual output +depends on the value of the 'MTA' variable in your etc/mailman.cfg file.""")) + parser.add_option('-q', '--quiet', + default=False, action='store_true', help=_("""\ +Some MTA output can include more verbose help text. Use this to tone down the +verbosity.""")) + parser.add_option('-C', '--config', + help=_('Alternative configuration file to use')) + opts, args = parser.parse_args() + if args: + parser.print_help() + print >> sys.stderr, _('Unexpected arguments') + sys.exit(1) + return parser, opts, args def main(): - quiet = False - try: - opts, args = getopt.getopt(sys.argv[1:], 'hq', - ['help', 'quiet']) - except getopt.error, msg: - usage(1, msg) - - for opt, arg in opts: - if opt in ('-h', '--help'): - usage(0) - elif opt in ('-q', '--quiet'): - quiet = True - - if args: - usage(1) + parser, opts, args = parseargs() + config.load(opts.config) # Import the MTA specific module - modulename = 'Mailman.MTA.' + mm_cfg.MTA + modulename = 'Mailman.MTA.' + config.MTA __import__(modulename) MTA = sys.modules[modulename] @@ -99,11 +77,11 @@ def main(): try: MTA.clear() if not mlists: - MTA.create(None, nolock=True, quiet=quiet) + MTA.create(None, nolock=True, quiet=opts.quiet) else: for hostname, vlists in mlists.items(): for mlist in vlists: - MTA.create(mlist, nolock=True, quiet=quiet) + MTA.create(mlist, nolock=True, quiet=opts.quiet) # Be verbose for only the first printed list quiet = True finally: diff --git a/Mailman/bin/mmsitepass.py b/Mailman/bin/mmsitepass.py index b6576c8fa..3bd2c77d7 100644 --- a/Mailman/bin/mmsitepass.py +++ b/Mailman/bin/mmsitepass.py @@ -20,7 +20,8 @@ import getpass import optparse from Mailman import Utils -from Mailman import mm_cfg +from Mailman import Version +from Mailman.configuration import config from Mailman.i18n import _ __i18n_templates__ = True @@ -28,7 +29,7 @@ __i18n_templates__ = True def parseargs(): - parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION, + parser = optparse.OptionParser(version=Version.MAILMAN_VERSION, usage=_("""\ %prog [options] [password] @@ -48,6 +49,8 @@ If password is not given on the command line, it will be prompted for. Set the list creator password instead of the site password. The list creator is authorized to create and remove lists, but does not have the total power of the site administrator.""")) + parser.add_option('-C', '--config', + help=_('Alternative configuration file to use')) opts, args = parser.parse_args() if len(args) > 1: parser.print_help() @@ -59,6 +62,7 @@ the total power of the site administrator.""")) def main(): parser, opts, args = parseargs() + config.load(opts.config) if args: password = args[0] else: diff --git a/bin/Makefile.in b/bin/Makefile.in index 1251cd831..1aeb68923 100644 --- a/bin/Makefile.in +++ b/bin/Makefile.in @@ -48,15 +48,15 @@ SCRIPTS= mmshell \ remove_members clone_member \ sync_members check_db withlist \ config_list dumpdb cleanarch \ - list_admins genaliases \ + list_admins \ fix_url.py convert.py transcheck \ msgfmt.py discard \ reset_pw.py templ2pot.py po2templ.py -LN_SCRIPTS= add_members arch change_pw check_perms find_member inject \ - list_lists list_members list_owners mailmanctl mmsitepass \ - newlist qrunner rmlist show_qfiles show_mm_cfg testall \ - unshunt update version +LN_SCRIPTS= add_members arch change_pw check_perms find_member \ + genaliases inject list_lists list_members list_owners \ + mailmanctl mmsitepass newlist qrunner rmlist show_qfiles \ + show_mm_cfg testall unshunt update version BUILDDIR= ../build/bin diff --git a/bin/withlist b/bin/withlist index b6bc8911f..f4648ed78 100644 --- a/bin/withlist +++ b/bin/withlist @@ -187,6 +187,9 @@ def do_list(listname, args, func): else: print >> sys.stderr, _('(unlocked)') + if '@' not in listname: + listname += '@' + config.DEFAULT_EMAIL_HOST + try: m = MailList.MailList(listname, lock=LOCK) except Errors.MMUnknownListError: @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 7942 . +# From configure.in Revision: 8038 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for GNU Mailman 2.2.0a0. # @@ -4292,7 +4292,6 @@ build/bin/convert.py:bin/convert.py \ build/bin/discard:bin/discard \ build/bin/dumpdb:bin/dumpdb \ build/bin/fix_url.py:bin/fix_url.py \ -build/bin/genaliases:bin/genaliases \ build/bin/list_admins:bin/list_admins \ build/bin/mmshell:bin/mmshell \ build/bin/msgfmt.py:bin/msgfmt.py \ diff --git a/configure.in b/configure.in index ac5cba61f..fd6e793dc 100644 --- a/configure.in +++ b/configure.in @@ -16,7 +16,7 @@ # USA. dnl Process this file with autoconf to produce a configure script. -AC_REVISION($Revision: 8038 $) +AC_REVISION($Revision: 8040 $) AC_PREREQ(2.0) AC_INIT([GNU Mailman], [2.2.0a0]) @@ -600,7 +600,6 @@ bin/convert.py \ bin/discard \ bin/dumpdb \ bin/fix_url.py \ -bin/genaliases \ bin/list_admins \ bin/mmshell \ bin/msgfmt.py \ |
