diff options
| author | Barry Warsaw | 2007-11-17 17:33:14 -0500 |
|---|---|---|
| committer | Barry Warsaw | 2007-11-17 17:33:14 -0500 |
| commit | 02f3861eae46de1b6e580e257d25aa9a4c73a687 (patch) | |
| tree | 06fafb751538ad0f3dcebbe02e8a06e8aa9f1f6b | |
| parent | 12ace359ccceb507ac2e55c1333f63d3d92af6f7 (diff) | |
| download | mailman-02f3861eae46de1b6e580e257d25aa9a4c73a687.tar.gz mailman-02f3861eae46de1b6e580e257d25aa9a4c73a687.tar.zst mailman-02f3861eae46de1b6e580e257d25aa9a4c73a687.zip | |
| -rw-r--r-- | Mailman/Defaults.py | 6 | ||||
| -rw-r--r-- | Mailman/Handlers/Hold.py | 5 | ||||
| -rw-r--r-- | Mailman/Handlers/Scrubber.py | 4 | ||||
| -rw-r--r-- | Mailman/MTA/Postfix.py | 6 | ||||
| -rw-r--r-- | Mailman/app/membership.py | 3 | ||||
| -rw-r--r-- | Mailman/bin/arch.py | 3 | ||||
| -rw-r--r-- | Mailman/bin/gate_news.py | 2 | ||||
| -rw-r--r-- | Mailman/bin/mailmanctl.py | 22 | ||||
| -rw-r--r-- | Mailman/bin/testall.py | 1 | ||||
| -rw-r--r-- | Mailman/configuration.py | 1 | ||||
| -rw-r--r-- | Mailman/initialize.py | 2 |
11 files changed, 27 insertions, 28 deletions
diff --git a/Mailman/Defaults.py b/Mailman/Defaults.py index 7175894bf..c4d9d7dbc 100644 --- a/Mailman/Defaults.py +++ b/Mailman/Defaults.py @@ -17,7 +17,6 @@ """Distributed default settings for significant Mailman config variables.""" -import os from datetime import timedelta from Mailman.interfaces import ReplyToMunging @@ -955,7 +954,7 @@ DEFAULT_GENERIC_NONMEMBER_ACTION = 1 DEFAULT_REQUIRE_EXPLICIT_DESTINATION = Yes # Alternate names acceptable as explicit destinations for this list. -DEFAULT_ACCEPTABLE_ALIASES =""" +DEFAULT_ACCEPTABLE_ALIASES = """ """ # For mailing lists that have only other mailing lists for members: DEFAULT_UMBRELLA_LIST = No @@ -1325,9 +1324,6 @@ AuthSiteAdmin = 5 # Site Administrator (total control over everything) -# Import a bunch of version numbers -from Version import * - # Vgg: Language descriptions and charsets dictionary, any new supported # language must have a corresponding entry here. Key is the name of the # directories that hold the localized texts. Data are tuples with first diff --git a/Mailman/Handlers/Hold.py b/Mailman/Handlers/Hold.py index bef1fa24f..f53c168c5 100644 --- a/Mailman/Handlers/Hold.py +++ b/Mailman/Handlers/Hold.py @@ -99,11 +99,12 @@ word `help' in it to the request address, $request, for further instructions.""") class SuspiciousHeaders(Errors.HoldMessage): - reason = _('Message has a suspicious header') - rejection = _('Your message had a suspicious header.') + reason = _('Message has a suspicious header') + rejection = _('Your message had a suspicious header.') class MessageTooBig(Errors.HoldMessage): def __init__(self, msgsize, limit): + Errors.HoldMessage.__init__(self) self.__msgsize = msgsize self.__limit = limit diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py index bb607b1d2..8581f52d4 100644 --- a/Mailman/Handlers/Scrubber.py +++ b/Mailman/Handlers/Scrubber.py @@ -26,17 +26,13 @@ import time import errno import logging import binascii -import tempfile -from cStringIO import StringIO from email.charset import Charset from email.generator import Generator -from email.parser import HeaderParser from email.utils import make_msgid, parsedate from locknix.lockfile import Lock from mimetypes import guess_all_extensions -from Mailman import Message from Mailman import Utils from Mailman.Errors import DiscardMessage from Mailman.app.archiving import get_base_archive_url diff --git a/Mailman/MTA/Postfix.py b/Mailman/MTA/Postfix.py index 268d2f325..c8ee211ea 100644 --- a/Mailman/MTA/Postfix.py +++ b/Mailman/MTA/Postfix.py @@ -257,7 +257,8 @@ def _do_create(mlist, textfile, func): try: fp = open(textfile, 'r+') except IOError, e: - if e.errno <> errno.ENOENT: raise + if e.errno <> errno.ENOENT: + raise fp = open(textfile, 'w+') try: func(mlist, fp) @@ -300,7 +301,8 @@ def _do_remove(mlist, textfile): try: infp = open(textfile) except IOError, e: - if e.errno <> errno.ENOENT: raise + if e.errno <> errno.ENOENT: + raise # Otherwise, there's no text file to filter so we're done. return try: diff --git a/Mailman/app/membership.py b/Mailman/app/membership.py index 56ad59ca5..030cc6006 100644 --- a/Mailman/app/membership.py +++ b/Mailman/app/membership.py @@ -21,6 +21,7 @@ from __future__ import with_statement from email.utils import formataddr +from Mailman import Errors from Mailman import Message from Mailman import Utils from Mailman import i18n @@ -79,7 +80,7 @@ def add_member(mlist, address, realname, password, delivery_mode, language, # Create the user and link it now. user = config.db.user_manager.create_user() user.real_name = (realname if realname else address_obj.real_name) - user,link(address_obj) + user.link(address_obj) # Since created the user, then the member, and set preferences on the # appropriate object. user.password = password diff --git a/Mailman/bin/arch.py b/Mailman/bin/arch.py index 6227482ad..dd65071cc 100644 --- a/Mailman/bin/arch.py +++ b/Mailman/bin/arch.py @@ -25,7 +25,6 @@ import optparse from locknix.lockfile import Lock -from Mailman import Errors from Mailman import Version from Mailman import i18n from Mailman.Archiver.HyperArch import HyperArchive @@ -93,7 +92,7 @@ numbers.""")) def main(): parser, opts, args = parseargs() - config.load(opts.config) + initialize(opts.config) i18n.set_language(config.DEFAULT_SERVER_LANGUAGE) diff --git a/Mailman/bin/gate_news.py b/Mailman/bin/gate_news.py index 9402504dc..e0c1d981a 100644 --- a/Mailman/bin/gate_news.py +++ b/Mailman/bin/gate_news.py @@ -235,7 +235,7 @@ def main(): try: with lockfile.Lock(GATENEWS_LOCK_FILE, # It's okay to hijack this - lifetime=LOCK_LIFETIME): + lifetime=LOCK_LIFETIME) as lock: process_lists(lock) clearcache() except lockfile.TimeOutError: diff --git a/Mailman/bin/mailmanctl.py b/Mailman/bin/mailmanctl.py index 8b7eeb5d2..d07bb40b0 100644 --- a/Mailman/bin/mailmanctl.py +++ b/Mailman/bin/mailmanctl.py @@ -28,8 +28,6 @@ import optparse from locknix import lockfile from Mailman import Defaults -from Mailman import Errors -from Mailman import Utils from Mailman import Version from Mailman import loginit from Mailman.configuration import config @@ -49,6 +47,10 @@ BIN_DIR = os.path.abspath(os.path.dirname(sys.argv[0])) LOCK_LIFETIME = Defaults.days(1) + Defaults.hours(6) SNOOZE = Defaults.days(1) +elog = None +qlog = None +opts = None + def parseargs(): @@ -133,7 +135,7 @@ error.""")) print >> sys.stderr, _('No command given.') sys.exit(1) if len(args) > 1: - parse.print_help() + parser.print_help() commands = COMMASPACE.join(args) print >> sys.stderr, _('Bad command: $commands') sys.exit(1) @@ -157,7 +159,8 @@ def kill_watcher(sig): try: os.kill(pid, sig) except OSError, e: - if e.errno <> errno.ESRCH: raise + if e.errno <> errno.ESRCH: + raise print >> sys.stderr, _('No child with pid: $pid') print >> sys.stderr, e print >> sys.stderr, _('Stale pid file removed.') @@ -279,7 +282,7 @@ def start_all_runners(): -def check_privs(): +def check_privs(parser): # If we're running as root (uid == 0), coerce the uid and gid to that # which Mailman was configured for, and refuse to run if we didn't coerce # the uid/gid. @@ -295,8 +298,8 @@ def check_privs(): os.setuid(uid) elif myuid <> uid: name = config.MAILMAN_USER - usage(1, _( - 'Run this program as root or as the $name user, or use -u.')) + parser.error( + _('Run this program as root or as the $name user, or use -u.')) @@ -310,7 +313,7 @@ def main(): qlog = logging.getLogger('mailman.qrunner') if opts.checkprivs: - check_privs() + check_privs(parser) else: print _('Warning! You may encounter permission problems.') @@ -417,7 +420,8 @@ def main(): try: os.kill(pid, signal.SIGTERM) except OSError, e: - if e.errno <> errno.ESRCH: raise + if e.errno <> errno.ESRCH: + raise qlog.info('Master watcher caught SIGTERM. Exiting.') signal.signal(signal.SIGTERM, sigterm_handler) # Finally, we need a SIGINT handler which will cause the sub-qrunners diff --git a/Mailman/bin/testall.py b/Mailman/bin/testall.py index 9be591253..81735d024 100644 --- a/Mailman/bin/testall.py +++ b/Mailman/bin/testall.py @@ -37,6 +37,7 @@ from Mailman.configuration import config from Mailman.i18n import _ from Mailman.initialize import initialize_1, initialize_2 +basedir = None __i18n_templates__ = True diff --git a/Mailman/configuration.py b/Mailman/configuration.py index eee9c8363..35b39d997 100644 --- a/Mailman/configuration.py +++ b/Mailman/configuration.py @@ -25,6 +25,7 @@ from Mailman import Defaults from Mailman import Errors from Mailman.languages import LanguageManager +SPACE = ' ' _missing = object() DEFAULT_QRUNNERS = ( diff --git a/Mailman/initialize.py b/Mailman/initialize.py index 0993acf3d..dff2677f3 100644 --- a/Mailman/initialize.py +++ b/Mailman/initialize.py @@ -25,8 +25,6 @@ by the command line arguments. """ import os -import sys -import pkg_resources from zope.interface.verify import verifyObject |
