diff options
| author | Barry Warsaw | 2008-10-06 22:07:04 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2008-10-06 22:07:04 -0400 |
| commit | c7340d712c640fa5992518a7cf16272f634abccc (patch) | |
| tree | 99057710fbc7b92eaa1720daea4c3a6cd5929cf3 /mailman/bin | |
| parent | 6f4351721559e8b7b577d3a01216fec88121ed11 (diff) | |
| parent | f0c9fad6372a645981b5c72fe02a6ad62f35790f (diff) | |
| download | mailman-c7340d712c640fa5992518a7cf16272f634abccc.tar.gz mailman-c7340d712c640fa5992518a7cf16272f634abccc.tar.zst mailman-c7340d712c640fa5992518a7cf16272f634abccc.zip | |
branch merge
Diffstat (limited to 'mailman/bin')
| -rw-r--r-- | mailman/bin/__init__.py | 1 | ||||
| -rw-r--r-- | mailman/bin/add_members.py | 4 | ||||
| -rw-r--r-- | mailman/bin/bumpdigests.py | 4 | ||||
| -rw-r--r-- | mailman/bin/change_pw.py | 177 | ||||
| -rw-r--r-- | mailman/bin/config_list.py | 8 | ||||
| -rw-r--r-- | mailman/bin/create_list.py | 6 | ||||
| -rw-r--r-- | mailman/bin/disabled.py | 4 | ||||
| -rw-r--r-- | mailman/bin/export.py | 4 | ||||
| -rw-r--r-- | mailman/bin/find_member.py | 4 | ||||
| -rw-r--r-- | mailman/bin/import.py | 4 | ||||
| -rw-r--r-- | mailman/bin/list_members.py | 4 | ||||
| -rw-r--r-- | mailman/bin/qrunner.py | 4 | ||||
| -rw-r--r-- | mailman/bin/remove_list.py | 1 | ||||
| -rw-r--r-- | mailman/bin/withlist.py | 3 |
14 files changed, 24 insertions, 204 deletions
diff --git a/mailman/bin/__init__.py b/mailman/bin/__init__.py index eb7e7b846..4c3fc1673 100644 --- a/mailman/bin/__init__.py +++ b/mailman/bin/__init__.py @@ -20,7 +20,6 @@ __all__ = [ 'arch', 'bounces', 'bumpdigests', - 'change_pw', 'check_perms', 'checkdbs', 'cleanarch', diff --git a/mailman/bin/add_members.py b/mailman/bin/add_members.py index 98e14c5e6..613d2b322 100644 --- a/mailman/bin/add_members.py +++ b/mailman/bin/add_members.py @@ -24,7 +24,7 @@ import codecs from cStringIO import StringIO from email.utils import parseaddr -from mailman import Errors +from mailman import errors from mailman import Message from mailman import Utils from mailman import i18n @@ -122,7 +122,7 @@ def addall(mlist, subscribers, delivery_mode, ack, admin_notify, outfp): config.DEFAULT_SERVER_LANGUAGE, ack, admin_notify) except AlreadySubscribedError: print >> tee, _('Already a member: $subscriber') - except Errors.InvalidEmailAddress: + except errors.InvalidEmailAddress: if not address: print >> tee, _('Bad/Invalid email address: blank line') else: diff --git a/mailman/bin/bumpdigests.py b/mailman/bin/bumpdigests.py index 7cde0d9de..2739a0fe6 100644 --- a/mailman/bin/bumpdigests.py +++ b/mailman/bin/bumpdigests.py @@ -18,7 +18,7 @@ import sys import optparse -from mailman import Errors +from mailman import errors from mailman import MailList from mailman.configuration import config from mailman.i18n import _ @@ -58,7 +58,7 @@ def main(): try: # Be sure the list is locked mlist = MailList.MailList(listname) - except Errors.MMListError, e: + except errors.MMListError, e: parser.print_help() print >> sys.stderr, _('No such list: $listname') sys.exit(1) diff --git a/mailman/bin/change_pw.py b/mailman/bin/change_pw.py deleted file mode 100644 index e67b951d2..000000000 --- a/mailman/bin/change_pw.py +++ /dev/null @@ -1,177 +0,0 @@ -# Copyright (C) 2001-2008 by the Free Software Foundation, Inc. -# -# This file is part of GNU Mailman. -# -# GNU Mailman 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 3 of the License, or (at your option) -# any later version. -# -# GNU Mailman 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 -# GNU Mailman. If not, see <http://www.gnu.org/licenses/>. - -from __future__ import with_statement - -import sha -import sys -import optparse - -from mailman import Errors -from mailman import MailList -from mailman import Message -from mailman import Utils -from mailman import i18n -from mailman.configuration import config -from mailman.version import MAILMAN_VERSION - -_ = i18n._ -SPACE = ' ' - - - -def parseargs(): - parser = optparse.OptionParser(version=MAILMAN_VERSION, - usage=_("""\ -%%prog [options] - -Change a list's password. - -Prior to Mailman 2.1, list passwords were kept in crypt'd format -- usually. -Some Python installations didn't have the crypt module available, so they'd -fall back to md5. Then suddenly the Python installation might grow a crypt -module and all list passwords would be broken. - -In Mailman 2.1, all list and site passwords are stored in SHA1 hexdigest -form. This breaks list passwords for all existing pre-Mailman 2.1 lists, and -since those passwords aren't stored anywhere in plain text, they cannot be -retrieved and updated. - -Thus, this script generates new passwords for a list, and optionally sends it -to all the owners of the list.""")) - parser.add_option('-a', '--all', - default=False, action='store_true', - help=_('Change the password for all lists')) - parser.add_option('-d', '--domain', - default=[], type='string', action='append', - dest='domains', help=_("""\ -Change the password for all lists in the virtual domain DOMAIN. It is okay -to give multiple -d options.""")) - parser.add_option('-l', '--listname', - default=[], type='string', action='append', - dest='listnames', help=_("""\ -Change the password only for the named list. It is okay to give multiple -l -options.""")) - parser.add_option('-p', '--password', - type='string', metavar='NEWPASSWORD', help=_("""\ -Use the supplied plain text password NEWPASSWORD as the new password for any -lists that are being changed (as specified by the -a, -d, and -l options). If -not given, lists will be assigned a randomly generated new password.""")) - parser.add_option('-q', '--quiet', - default=False, action='store_true', help=_("""\ -Don't notify list owners of the new password. You'll have to have some other -way of letting the list owners know the new password (presumably -out-of-band).""")) - 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) - if opts.password == '': - parser.print_help() - print >> sys.stderr, _('Empty list passwords are not allowed') - sys.exit(1) - return parser, opts, args - - - -_listcache = {} -_missing = object() - -def openlist(listname): - missing = [] - mlist = _listcache.get(listname, _missing) - if mlist is _missing: - try: - mlist = MailList.MailList(listname, lock=False) - except Errors.MMListError: - print >> sys.stderr, _('No such list: $listname') - return None - _listcache[listname] = mlist - return mlist - - - -def main(): - parser, opts, args = parseargs() - config.load(opts.config) - - # Cull duplicates - domains = set(opts.domains) - listnames = set(config.list_manager.names if opts.all else opts.listnames) - - if domains: - for name in config.list_manager.names: - mlist = openlist(name) - if mlist.host_name in domains: - listnames.add(name) - - if not listnames: - print >> sys.stderr, _('Nothing to do.') - sys.exit(0) - - # Set the password on the lists - if opts.password: - shapassword = sha.new(opts.password).hexdigest() - - for listname in listnames: - mlist = openlist(listname) - mlist.Lock() - try: - if opts.password is None: - randompw = Utils.MakeRandomPassword( - config.ADMIN_PASSWORD_LENGTH) - shapassword = sha.new(randompw).hexdigest() - notifypassword = randompw - else: - notifypassword = opts.password - - mlist.password = shapassword - mlist.Save() - finally: - mlist.Unlock() - - # Notification - print _('New $listname password: $notifypassword') - if not opts.quiet: - with i18n.using_language(mlist.preferred_language): - hostname = mlist.host_name - adminurl = mlist.GetScriptURL('admin', absolute=True) - msg = Message.UserNotification( - mlist.owner[:], mlist.no_reply_address, - _('Your new $listname list password'), - _('''\ -The site administrator at $hostname has changed the password for your -mailing list $listname. It is now - - $notifypassword - -Please be sure to use this for all future list administration. You may want -to log in now to your list and change the password to something more to your -liking. Visit your list admin page at - - $adminurl -'''), - mlist.preferred_language) - msg.send(mlist) - - - -if __name__ == '__main__': - main() diff --git a/mailman/bin/config_list.py b/mailman/bin/config_list.py index 814b9640c..7fb3e73a7 100644 --- a/mailman/bin/config_list.py +++ b/mailman/bin/config_list.py @@ -20,7 +20,7 @@ import sys import time import optparse -from mailman import Errors +from mailman import errors from mailman import MailList from mailman import Utils from mailman import i18n @@ -97,7 +97,7 @@ def do_output(listname, outfile, parser): # Open the specified list unlocked, since we're only reading it. try: mlist = MailList.MailList(listname, lock=False) - except Errors.MMListError: + except errors.MMListError: parser.error(_('No such list: $listname')) # Preamble for the config info. PEP 263 charset and capture time. language = mlist.preferred_language @@ -246,7 +246,7 @@ def do_input(listname, infile, checkonly, verbose, parser): # Open the specified list locked, unless checkonly is set try: mlist = MailList.MailList(listname, lock=not checkonly) - except Errors.MMListError, e: + except errors.MMListError, e: parser.error(_('No such list "$listname"\n$e')) savelist = False guibyprop = getPropertyMap(mlist) @@ -278,7 +278,7 @@ def do_input(listname, infile, checkonly, verbose, parser): validval = gui._getValidValue(mlist, k, wtype, v) except ValueError: print >> sys.stderr, _('Invalid value for property: $k') - except Errors.EmailAddressError: + except errors.EmailAddressError: print >> sys.stderr, _( 'Bad email address for option $k: $v') else: diff --git a/mailman/bin/create_list.py b/mailman/bin/create_list.py index f581184dc..c25ab3283 100644 --- a/mailman/bin/create_list.py +++ b/mailman/bin/create_list.py @@ -19,7 +19,7 @@ from __future__ import with_statement import sys -from mailman import Errors +from mailman import errors from mailman import Message from mailman import Utils from mailman import i18n @@ -100,11 +100,11 @@ def main(): try: mlist = create_list(fqdn_listname, options.options.owners) mlist.preferred_language = options.options.language - except Errors.InvalidEmailAddress: + except errors.InvalidEmailAddress: options.parser.error(_('Illegal list name: $fqdn_listname')) except ListAlreadyExistsError: options.parser.error(_('List already exists: $fqdn_listname')) - except Errors.BadDomainSpecificationError, domain: + except errors.BadDomainSpecificationError, domain: options.parser.error(_('Undefined domain: $domain')) config.db.commit() diff --git a/mailman/bin/disabled.py b/mailman/bin/disabled.py index ae57757f1..31fd0c014 100644 --- a/mailman/bin/disabled.py +++ b/mailman/bin/disabled.py @@ -19,7 +19,7 @@ import time import logging import optparse -from mailman import Errors +from mailman import errors from mailman import MailList from mailman import MemberAdaptor from mailman import Pending @@ -183,7 +183,7 @@ def main(): member, mlist.internal_name()) try: mlist.sendNextNotification(member) - except Errors.NotAMemberError: + except errors.NotAMemberError: # There must have been some problem with the data we have # on this member. Most likely it's that they don't have a # password assigned. Log this and delete the member. diff --git a/mailman/bin/export.py b/mailman/bin/export.py index 1834205e7..e494d5a8d 100644 --- a/mailman/bin/export.py +++ b/mailman/bin/export.py @@ -29,7 +29,7 @@ import optparse from xml.sax.saxutils import escape from mailman import Defaults -from mailman import Errors +from mailman import errors from mailman import MemberAdaptor from mailman.MailList import MailList from mailman.configuration import config @@ -247,7 +247,7 @@ class XMLDumper(object): for listname in sorted(listnames): try: mlist = MailList(listname, lock=False) - except Errors.MMUnknownListError: + except errors.MMUnknownListError: print >> sys.stderr, _('No such list: $listname') continue self._dump_list(mlist) diff --git a/mailman/bin/find_member.py b/mailman/bin/find_member.py index e605767a7..605e243b4 100644 --- a/mailman/bin/find_member.py +++ b/mailman/bin/find_member.py @@ -19,7 +19,7 @@ import re import sys import optparse -from mailman import Errors +from mailman import errors from mailman import MailList from mailman.configuration import config from mailman.i18n import _ @@ -93,7 +93,7 @@ def main(): for listname in listnames: try: mlist = MailList.MailList(listname, lock=False) - except Errors.MMListError: + except errors.MMListError: print _('No such list: $listname') continue if opts.owners: diff --git a/mailman/bin/import.py b/mailman/bin/import.py index 51dffceb9..2617cca99 100644 --- a/mailman/bin/import.py +++ b/mailman/bin/import.py @@ -26,7 +26,7 @@ from xml.dom import minidom from xml.parsers.expat import ExpatError from mailman import Defaults -from mailman import Errors +from mailman import errors from mailman import MemberAdaptor from mailman import Utils from mailman import passwords @@ -202,7 +202,7 @@ def create(all_listdata): print _('Creating mailing list: $fqdn_listname') mlist.Create(fqdn_listname, list_config['owner'][0], list_config['password']) - except Errors.BadDomainSpecificationError: + except errors.BadDomainSpecificationError: print _('List is not in a supported domain: $fqdn_listname') continue # Save the list creation, then unlock and relock the list. This is so diff --git a/mailman/bin/list_members.py b/mailman/bin/list_members.py index 31bc61b0c..a5b047504 100644 --- a/mailman/bin/list_members.py +++ b/mailman/bin/list_members.py @@ -19,7 +19,7 @@ import sys from email.Utils import formataddr -from mailman import Errors +from mailman import errors from mailman import Utils from mailman.configuration import config from mailman.i18n import _ @@ -120,7 +120,7 @@ def isinvalid(addr): try: Utils.ValidateEmail(addr) return False - except Errors.EmailAddressError: + except errors.EmailAddressError: return True diff --git a/mailman/bin/qrunner.py b/mailman/bin/qrunner.py index 33c17f91d..422809fa3 100644 --- a/mailman/bin/qrunner.py +++ b/mailman/bin/qrunner.py @@ -149,9 +149,9 @@ def make_qrunner(name, slice, range, once=False): raise qrclass = getattr(sys.modules[modulename], classname) if once: - # Subclass to hack in the setting of the stop flag in _doperiodic() + # Subclass to hack in the setting of the stop flag in _do_periodic() class Once(qrclass): - def _doperiodic(self): + def _do_periodic(self): self.stop() qrunner = Once(slice, range) else: diff --git a/mailman/bin/remove_list.py b/mailman/bin/remove_list.py index 76db51f2d..b83c56bbf 100644 --- a/mailman/bin/remove_list.py +++ b/mailman/bin/remove_list.py @@ -19,7 +19,6 @@ import os import sys import shutil -from mailman import Errors from mailman import Utils from mailman.app.lifecycle import remove_list from mailman.configuration import config diff --git a/mailman/bin/withlist.py b/mailman/bin/withlist.py index daf009ca3..32bfb1206 100644 --- a/mailman/bin/withlist.py +++ b/mailman/bin/withlist.py @@ -19,7 +19,6 @@ import os import sys import optparse -from mailman import Errors from mailman import interact from mailman.configuration import config from mailman.i18n import _ @@ -105,7 +104,7 @@ As another example, say you wanted to change the password for a particular user on a particular list. You could put the following function in a file called 'changepw.py': - from mailman.Errors import NotAMemberError + from mailman.errors import NotAMemberError def changepw(mlist, addr, newpasswd): try: |
