summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbwarsaw2006-04-29 19:23:36 +0000
committerbwarsaw2006-04-29 19:23:36 +0000
commita63a04fb8d263a6464a77de6894bc738e8e26529 (patch)
tree2cbbb4dea5d1377b753ab76d76376e1903d17808
parent7c195b1f29ef15dcc933130e38386c76885100cd (diff)
downloadmailman-a63a04fb8d263a6464a77de6894bc738e8e26529.tar.gz
mailman-a63a04fb8d263a6464a77de6894bc738e8e26529.tar.zst
mailman-a63a04fb8d263a6464a77de6894bc738e8e26529.zip
-rw-r--r--Mailman/bin/list_lists.py96
-rwxr-xr-xMailman/bin/list_members.py226
-rw-r--r--Mailman/i18n.py33
-rw-r--r--Mailman/loginit.py5
-rw-r--r--bin/Makefile.in6
-rw-r--r--bin/list_lists122
-rwxr-xr-xbin/list_members286
-rwxr-xr-xconfigure4
-rw-r--r--configure.in4
9 files changed, 354 insertions, 428 deletions
diff --git a/Mailman/bin/list_lists.py b/Mailman/bin/list_lists.py
new file mode 100644
index 000000000..a3493c3b8
--- /dev/null
+++ b/Mailman/bin/list_lists.py
@@ -0,0 +1,96 @@
+# Copyright (C) 1998-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
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+import sys
+import optparse
+
+from Mailman import MailList
+from Mailman import Utils
+from Mailman import mm_cfg
+from Mailman.i18n import _
+
+__i18n_templates__ = True
+
+
+
+def parseargs():
+ parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
+ usage=_("""\
+%prog [options]
+
+List all mailing lists."""))
+ parser.add_option('-a', '--advertised',
+ default=False, action='store_true',
+ help=_("""\
+List only those mailing lists that are publicly advertised"""))
+ parser.add_option('-b', '--bare',
+ default=False, action='store_true',
+ help=_("""\
+Displays only the list name, with no description."""))
+ parser.add_option('-V', '--virtual-host-overview',
+ default=None, type='string', dest='vhost',
+ help=_("""\
+List only those mailing lists that are homed to the given virtual domain.
+This only works if the VIRTUAL_HOST_OVERVIEW variable is set."""))
+ opts, args = parser.parse_args()
+ if args:
+ parser.print_help()
+ print >> sys.stderr, _('Unexpected arguments')
+ sys.exit(1)
+ return parser, opts, args
+
+
+
+def main():
+ parser, opts, args = parseargs()
+
+ names = Utils.list_names()
+ names.sort()
+ mlists = []
+ longest = 0
+
+ for n in names:
+ mlist = MailList.MailList(n, lock=False)
+ if opts.advertised and not mlist.advertised:
+ continue
+ if opts.vhost and mm_cfg.VIRTUAL_HOST_OVERVIEW and \
+ opts.vhost.find(mlist.web_page_url) == -1 and \
+ mlist.web_page_url.find(opts.vhost) == -1:
+ continue
+ mlists.append(mlist)
+ longest = max(len(mlist.real_name), longest)
+
+ if not mlists and not opts.bare:
+ print _('No matching mailing lists found')
+ return
+
+ if not opts.bare:
+ num_mlists = len(mlists)
+ print _('$num_mlists matching mailing lists found:')
+
+ format = '%%%ds - %%.%ds' % (longest, 77 - longest)
+ for mlist in mlists:
+ if opts.bare:
+ print mlist.internal_name()
+ else:
+ description = mlist.description or _('[no description available]')
+ print ' ', format % (mlist.real_name, description)
+
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Mailman/bin/list_members.py b/Mailman/bin/list_members.py
new file mode 100755
index 000000000..1239b955f
--- /dev/null
+++ b/Mailman/bin/list_members.py
@@ -0,0 +1,226 @@
+# Copyright (C) 1998-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
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+# USA.
+
+import sys
+import optparse
+
+from email.Utils import formataddr
+
+from Mailman import Errors
+from Mailman import MailList
+from Mailman import MemberAdaptor
+from Mailman import Utils
+from Mailman import mm_cfg
+from Mailman.i18n import _
+
+__i18n_templates__ = True
+
+ENC = sys.getdefaultencoding()
+COMMASPACE = ', '
+
+WHYCHOICES = {
+ 'enabled' : MemberAdaptor.ENABLED,
+ 'unknown' : MemberAdaptor.UNKNOWN,
+ 'byuser' : MemberAdaptor.BYUSER,
+ 'byadmin' : MemberAdaptor.BYADMIN,
+ 'bybounce': MemberAdaptor.BYBOUNCE,
+ }
+
+KINDCHOICES = set(('mime', 'plain', 'any'))
+
+
+
+def parseargs():
+ parser = optparse.OptionParser(version=mm_cfg.MAILMAN_VERSION,
+ usage=_("""\
+%prog [options] listname
+
+List all the members of a mailing list. Note that with the options below, if
+neither -r or -d is supplied, regular members are printed first, followed by
+digest members, but no indication is given as to address status.
+
+listname is the name of the mailing list to use."""))
+ parser.add_option('-o', '--output',
+ type='string', help=_("""\
+Write output to specified file instead of standard out."""))
+ parser.add_option('-r', '--regular',
+ default=None, action='store_true',
+ help=_('Print just the regular (non-digest) members.'))
+ parser.add_option('-d', '--digest',
+ default=None, type='string', metavar='KIND',
+ help=_("""\
+Print just the digest members. KIND can be 'mime', 'plain', or
+'any'. 'mime' prints just the members receiving MIME digests, while 'plain'
+prints just the members receiving plain text digests. 'any' prints all
+members receiving any kind of digest."""))
+ parser.add_option('-n', '--nomail',
+ type='string', metavar='WHY', help=_("""\
+Print the members that have delivery disabled. WHY selects just the subset of
+members with delivery disabled for a particular reason, where 'any' prints all
+disabled members. 'byadmin', 'byuser', 'bybounce', and 'unknown' prints just
+the users who are disabled for that particular reason. WHY can also be
+'enabled' which prints just those members for whom delivery is enabled."""))
+ parser.add_option('-f', '--fullnames',
+ default=False, action='store_true',
+ help=_('Include the full names in the output'))
+ parser.add_option('-p', '--preserve',
+ default=False, action='store_true', help=_("""\
+Output member addresses case preserved the way they were added to the list.
+Otherwise, addresses are printed in all lowercase."""))
+ parser.add_option('-i', '--invalid',
+ default=False, action='store_true', help=_("""\
+Print only the addresses in the membership list that are invalid. Ignores -r,
+-d, -n."""))
+ parser.add_option('-u', '--unicode',
+ default=False, action='store_true', help=_("""\
+Print addresses which are stored as Unicode objects instead of normal string
+objects. Ignores -r, -d, -n."""))
+ opts, args = parser.parse_args()
+ if not args:
+ parser.print_help()
+ print >> sys.stderr, _('Missing listname')
+ sys.exit(1)
+ if len(args) > 1:
+ parser.print_help()
+ print >> sys.stderr, _('Unexpected arguments')
+ sys.exit(1)
+ if opts.digest is not None:
+ opts.kind = opts.digest.lower()
+ if opts.kind not in KINDCHOICES:
+ parser.print_help()
+ print >> sys.stderr, _('Invalid value for -d: $opts.digest')
+ sys.exit(1)
+ if opts.nomail is not None:
+ why = opts.nomail.lower()
+ if why == 'any':
+ opts.why = 'any'
+ elif why not in WHYCHOICES:
+ parser.print_help()
+ print >> sys.stderr, _('Invalid value for -n: $opts.nomail')
+ sys.exit(1)
+ opts.why = why
+ if opts.regular is None and opts.digest is None:
+ opts.regular = opts.digest = True
+ opts.kind = 'any'
+ return parser, opts, args
+
+
+
+def isunicode(s):
+ return isinstance(s, unicode)
+
+
+def safe(s):
+ if not s:
+ return ''
+ if isunicode(s):
+ return s.encode(ENC, 'replace')
+ return unicode(s, ENC, 'replace').encode(ENC, 'replace')
+
+
+def isinvalid(addr):
+ try:
+ Utils.ValidateEmail(addr)
+ return False
+ except Errors.EmailAddressError:
+ return True
+
+
+
+def whymatches(mlist, addr, why):
+ # Return true if the `why' matches the reason the address is enabled, or
+ # in the case of why is None, that they are disabled for any reason
+ # (i.e. not enabled).
+ status = mlist.getDeliveryStatus(addr)
+ if why in (None, 'any'):
+ return status <> MemberAdaptor.ENABLED
+ return status == WHYCHOICES[why]
+
+
+
+def main():
+ parser, opts, args = parseargs()
+
+ listname = args[0].lower().strip()
+ if opts.output:
+ try:
+ fp = open(opts.output, 'w')
+ except IOError:
+ print >> sys.stderr, _(
+ 'Could not open file for writing: $opts.output')
+ sys.exit(1)
+ else:
+ fp = sys.stdout
+
+ try:
+ mlist = MailList.MailList(listname, lock=False)
+ except Errors.MMListError:
+ print >> sys.stderr, _('No such list: $listname')
+ sys.exit(1)
+
+ # Get the lowercased member addresses
+ rmembers = mlist.getRegularMemberKeys()
+ dmembers = mlist.getDigestMemberKeys()
+
+ if opts.preserve:
+ # Convert to the case preserved addresses
+ rmembers = mlist.getMemberCPAddresses(rmembers)
+ dmembers = mlist.getMemberCPAddresses(dmembers)
+
+ if opts.invalid or opts.unicode:
+ all = rmembers + dmembers
+ all.sort()
+ for addr in all:
+ name = opts.fullnames and mlist.getMemberName(addr) or ''
+ showit = False
+ if opts.invalid and isinvalid(addr):
+ showit = True
+ if opts.unicode and isunicode(addr):
+ showit = True
+ if showit:
+ print >> fp, formataddr((safe(name), addr))
+ return
+ if opts.regular:
+ rmembers.sort()
+ for addr in rmembers:
+ name = opts.fullnames and mlist.getMemberName(addr) or ''
+ # Filter out nomails
+ if opts.nomail and not whymatches(mlist, addr, opts.why):
+ continue
+ print >> fp, formataddr((safe(name), addr))
+ if opts.digest:
+ dmembers.sort()
+ for addr in dmembers:
+ name = opts.fullnames and mlist.getMemberName(addr) or ''
+ # Filter out nomails
+ if opts.nomail and not whymatches(mlist, addr, opts.why):
+ continue
+ # Filter out digest kinds
+ if mlist.getMemberOption(addr, mm_cfg.DisableMime):
+ # They're getting plain text digests
+ if opts.kind == 'mime':
+ continue
+ else:
+ # They're getting MIME digests
+ if opts.kind == 'plain':
+ continue
+ print >> fp, formataddr((safe(name), addr))
+
+
+
+if __name__ == '__main__':
+ main()
diff --git a/Mailman/i18n.py b/Mailman/i18n.py
index 051d55249..7d36e22d3 100644
--- a/Mailman/i18n.py
+++ b/Mailman/i18n.py
@@ -17,14 +17,28 @@
import sys
import time
+import string
import gettext
-from string import Template
-
from Mailman import mm_cfg
from Mailman.SafeDict import SafeDict
_translation = None
+_missing = object()
+
+class Template(string.Template):
+ idpattern = r'[_a-z][_a-z0-9.]*'
+
+
+class attrdict(dict):
+ def __getitem__(self, key):
+ parts = key.split('.')
+ value = super(attrdict, self).__getitem__(parts.pop(0))
+ while parts:
+ value = getattr(value, parts.pop(0), _missing)
+ if value is _missing:
+ raise KeyError(key)
+ return value
@@ -80,8 +94,9 @@ def _(s):
frame = sys._getframe(1)
# A `safe' dictionary is used so we won't get an exception if there's a
# missing key in the dictionary.
- substitutions = SafeDict(frame.f_globals.copy())
- substitutions.update(frame.f_locals)
+ d = frame.f_globals.copy()
+ d.update(frame.f_locals)
+ use_templates = d.get('__i18n_templates__', False)
# Translating the string returns an encoded 8-bit string. Rather than
# turn that into a Unicode, we turn any Unicodes in the dictionary values
# into encoded 8-bit strings. XXX: Returning a Unicode here broke too
@@ -91,13 +106,13 @@ def _(s):
charset = _translation.charset()
if not charset:
charset = 'us-ascii'
- for k, v in substitutions.items():
+ for k, v in d.items():
if isinstance(v, unicode):
- substitutions[k] = v.encode(charset, 'replace')
+ d[k] = v.encode(charset, 'replace')
# Are we using $-strings or %-strings?
- if substitutions.get('__i18n_templates__', False):
- return Template(tns).substitute(substitutions)
- return tns % substitutions
+ if d.get('__i18n_templates__', False):
+ return Template(tns).safe_substitute(attrdict(d))
+ return tns % SafeDict(d)
diff --git a/Mailman/loginit.py b/Mailman/loginit.py
index aa4ad63be..bcb016f08 100644
--- a/Mailman/loginit.py
+++ b/Mailman/loginit.py
@@ -61,10 +61,11 @@ class ReopenableFileHandler(logging.Handler):
def emit(self, record):
try:
msg = self.format(record)
+ fs = '%s\n'
try:
- self._stream.write(msg)
+ self._stream.write(fs % msg)
except UnicodeError:
- self._stream.write(msg.encode('string-escape'))
+ self._stream.write(fs % msg.encode('string-escape'))
self.flush()
except:
self.handleError(record)
diff --git a/bin/Makefile.in b/bin/Makefile.in
index 6e6ba81d6..2cc6c41c4 100644
--- a/bin/Makefile.in
+++ b/bin/Makefile.in
@@ -45,15 +45,15 @@ SCRIPTSDIR= $(prefix)/bin
SHELL= /bin/sh
SCRIPTS= mmshell add_members \
- list_members remove_members clone_member update \
+ remove_members clone_member update \
sync_members check_db withlist check_perms find_member \
- version config_list list_lists dumpdb cleanarch \
+ version config_list dumpdb cleanarch \
list_admins genaliases change_pw mailmanctl qrunner inject \
fix_url.py convert.py transcheck \
list_owners msgfmt.py show_qfiles discard rb-archfix \
reset_pw.py templ2pot.py po2templ.py
-LN_SCRIPTS= arch mmsitepass newlist rmlist unshunt
+LN_SCRIPTS= arch list_lists list_members mmsitepass newlist rmlist unshunt
BUILDDIR= ../build/bin
diff --git a/bin/list_lists b/bin/list_lists
deleted file mode 100644
index 870759b99..000000000
--- a/bin/list_lists
+++ /dev/null
@@ -1,122 +0,0 @@
-#! @PYTHON@
-#
-# Copyright (C) 1998,1999,2000,2001,2002 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""List all mailing lists.
-
-Usage: %(program)s [options]
-
-Where:
-
- -a / --advertised
- List only those mailing lists that are publically advertised
-
- --virtual-host-overview=domain
- -V domain
- List only those mailing lists that are homed to the given virtual
- domain. This only works if the VIRTUAL_HOST_OVERVIEW variable is
- set.
-
- -b / --bare
- Displays only the list name, with no description.
-
- -h / --help
- Print this text and exit.
-
-"""
-
-import sys
-import getopt
-import paths
-
-from Mailman import mm_cfg
-from Mailman import MailList
-from Mailman import Utils
-from Mailman import Errors
-from Mailman.i18n import _
-
-program = sys.argv[0]
-
-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 main():
- try:
- opts, args = getopt.getopt(sys.argv[1:], 'abV:h',
- ['advertised', 'bare',
- 'virtual-host-overview=',
- 'help'])
- except getopt.error, msg:
- usage(1, msg)
-
- advertised = 0
- vhost = None
- bare = 0
- for opt, arg in opts:
- if opt in ('-h', '--help'):
- usage(0)
- elif opt in ('-a', '--advertised'):
- advertised = 1
- elif opt in ('-V', '--virtual-host-overview'):
- vhost = arg
- elif opt in ('-b', '--bare'):
- bare = 1
-
- names = Utils.list_names()
- names.sort()
-
- mlists = []
- longest = 0
- for n in names:
- mlist = MailList.MailList(n, lock=0)
- if advertised and not mlist.advertised:
- continue
- if vhost and mm_cfg.VIRTUAL_HOST_OVERVIEW and \
- vhost.find(mlist.web_page_url) == -1 and \
- mlist.web_page_url.find(vhost) == -1:
- continue
- mlists.append(mlist)
- longest = max(len(mlist.real_name), longest)
-
- if not mlists and not bare:
- print _('No matching mailing lists found')
- return
-
- if not bare:
- print len(mlists), _('matching mailing lists found:')
-
- format = '%%%ds - %%.%ds' % (longest, 77 - longest)
- for mlist in mlists:
- if bare:
- print mlist.internal_name()
- else:
- description = mlist.description or _('[no description available]')
- print ' ', format % (mlist.real_name, description)
-
-
-
-if __name__ == '__main__':
- main()
diff --git a/bin/list_members b/bin/list_members
deleted file mode 100755
index cb5740817..000000000
--- a/bin/list_members
+++ /dev/null
@@ -1,286 +0,0 @@
-#! @PYTHON@
-#
-# Copyright (C) 1998-2003 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-"""List all the members of a mailing list.
-
-Usage: %(PROGRAM)s [options] listname
-
-Where:
-
- --output file
- -o file
- Write output to specified file instead of standard out.
-
- --regular / -r
- Print just the regular (non-digest) members.
-
- --digest[=kind] / -d [kind]
- Print just the digest members. Optional argument can be "mime" or
- "plain" which prints just the digest members receiving that kind of
- digest.
-
- --nomail[=why] / -n [why]
- Print the members that have delivery disabled. Optional argument can
- be "byadmin", "byuser", "bybounce", or "unknown" which prints just the
- users who have delivery disabled for that reason. It can also be
- "enabled" which prints just those member for whom delivery is
- enabled.
-
- --fullnames / -f
- Include the full names in the output.
-
- --preserve / -p
- Output member addresses case preserved the way they were added to the
- list. Otherwise, addresses are printed in all lowercase.
-
- --invalid / -i
- Print only the addresses in the membership list that are invalid.
- Ignores -r, -d, -n.
-
- --unicode / -u
- Print addresses which are stored as Unicode objects instead of normal
- string objects. Ignores -r, -d, -n.
-
- --help
- -h
- Print this help message and exit.
-
- listname is the name of the mailing list to use.
-
-Note that if neither -r or -d is supplied, both regular members are printed
-first, followed by digest members, but no indication is given as to address
-status.
-"""
-
-import sys
-from types import UnicodeType
-
-import paths
-from Mailman import mm_cfg
-from Mailman import Utils
-from Mailman import MailList
-from Mailman import Errors
-from Mailman import MemberAdaptor
-from Mailman.i18n import _
-
-from email.Utils import formataddr
-
-PROGRAM = sys.argv[0]
-ENC = sys.getdefaultencoding()
-COMMASPACE = ', '
-
-try:
- True, False
-except NameError:
- True = 1
- False = 0
-
-
-WHYCHOICES = {'enabled' : MemberAdaptor.ENABLED,
- 'unknown' : MemberAdaptor.UNKNOWN,
- 'byuser' : MemberAdaptor.BYUSER,
- 'byadmin' : MemberAdaptor.BYADMIN,
- 'bybounce': MemberAdaptor.BYBOUNCE,
- }
-
-
-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 safe(s):
- if not s:
- return ''
- if isinstance(s, UnicodeType):
- return s.encode(ENC, 'replace')
- return unicode(s, ENC, 'replace').encode(ENC, 'replace')
-
-
-def isinvalid(addr):
- try:
- Utils.ValidateEmail(addr)
- return False
- except Errors.EmailAddressError:
- return True
-
-def isunicode(addr):
- return isinstance(addr, UnicodeType)
-
-
-
-def whymatches(mlist, addr, why):
- # Return true if the `why' matches the reason the address is enabled, or
- # in the case of why is None, that they are disabled for any reason
- # (i.e. not enabled).
- status = mlist.getDeliveryStatus(addr)
- if why is None:
- return status <> MemberAdaptor.ENABLED
- return status == WHYCHOICES[why]
-
-
-
-def main():
- # Because of the optional arguments, we can't use getopt. :(
- outfile = None
- regular = None
- digest = None
- preserve = None
- nomail = None
- why = None
- kind = None
- fullnames = False
- invalidonly = False
- unicodeonly = False
-
- # Throw away the first (program) argument
- args = sys.argv[1:]
- if not args:
- usage(0)
-
- while True:
- try:
- opt = args.pop(0)
- except IndexError:
- usage(1)
- if opt in ('-h', '--help'):
- usage(0)
- elif opt in ('-f', '--fullnames'):
- fullnames = True
- elif opt in ('-p', '--preserve'):
- preserve = True
- elif opt in ('-r', '--regular'):
- regular = True
- elif opt in ('-o', '--output'):
- try:
- outfile = args.pop(0)
- except IndexError:
- usage(1)
- elif opt == '-n':
- nomail = True
- if args and args[0] in WHYCHOICES.keys():
- why = args.pop(0)
- elif opt.startswith('--nomail'):
- nomail = True
- i = opt.find('=')
- if i >= 0:
- why = opt[i+1:]
- if why not in WHYCHOICES.keys():
- usage(1, _('Bad --nomail option: %(why)s'))
- elif opt == '-d':
- digest = True
- if args and args[0] in ('mime', 'plain'):
- kind = args.pop(0)
- elif opt.startswith('--digest'):
- digest = True
- i = opt.find('=')
- if i >= 0:
- kind = opt[i+1:]
- if kind not in ('mime', 'plain'):
- usage(1, _('Bad --digest option: %(kind)s'))
- elif opt in ('-i', '--invalid'):
- invalidonly = True
- elif opt in ('-u', '--unicode'):
- unicodeonly = True
- else:
- # No more options left, push the last one back on the list
- args.insert(0, opt)
- break
-
- if len(args) <> 1:
- usage(1)
-
- listname = args[0].lower().strip()
-
- if regular is None and digest is None:
- regular = digest = True
-
- if outfile:
- try:
- fp = open(outfile, 'w')
- except IOError:
- print >> sys.stderr, _('Could not open file for writing:'), outfile
- sys.exit(1)
- else:
- fp = sys.stdout
-
- try:
- mlist = MailList.MailList(listname, lock=False)
- except Errors.MMListError, e:
- print >> sys.stderr, _('No such list: %(listname)s')
- sys.exit(1)
-
- # Get the lowercased member addresses
- rmembers = mlist.getRegularMemberKeys()
- dmembers = mlist.getDigestMemberKeys()
-
- if preserve:
- # Convert to the case preserved addresses
- rmembers = mlist.getMemberCPAddresses(rmembers)
- dmembers = mlist.getMemberCPAddresses(dmembers)
-
- if invalidonly or unicodeonly:
- all = rmembers + dmembers
- all.sort()
- for addr in all:
- name = fullnames and mlist.getMemberName(addr) or ''
- showit = False
- if invalidonly and isinvalid(addr):
- showit = True
- if unicodeonly and isunicode(addr):
- showit = True
- if showit:
- print >> fp, formataddr((safe(name), addr))
- return
- if regular:
- rmembers.sort()
- for addr in rmembers:
- name = fullnames and mlist.getMemberName(addr) or ''
- # Filter out nomails
- if nomail and not whymatches(mlist, addr, why):
- continue
- print >> fp, formataddr((safe(name), addr))
- if digest:
- dmembers.sort()
- for addr in dmembers:
- name = fullnames and mlist.getMemberName(addr) or ''
- # Filter out nomails
- if nomail and not whymatches(mlist, addr, why):
- continue
- # Filter out digest kinds
- if mlist.getMemberOption(addr, mm_cfg.DisableMime):
- # They're getting plain text digests
- if kind == 'mime':
- continue
- else:
- # They're getting MIME digests
- if kind == 'plain':
- continue
- print >> fp, formataddr((safe(name), addr))
-
-
-
-if __name__ == '__main__':
- main()
diff --git a/configure b/configure
index 4f5c1e417..e3674039e 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 7876 .
+# From configure.in Revision: 7881 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
@@ -4291,8 +4291,6 @@ build/bin/fix_url.py:bin/fix_url.py \
build/bin/genaliases:bin/genaliases \
build/bin/inject:bin/inject \
build/bin/list_admins:bin/list_admins \
-build/bin/list_lists:bin/list_lists \
-build/bin/list_members:bin/list_members \
build/bin/list_owners:bin/list_owners \
build/bin/mailmanctl:bin/mailmanctl \
build/bin/mmshell:bin/mmshell \
diff --git a/configure.in b/configure.in
index d0f3667ad..34aee4ab9 100644
--- a/configure.in
+++ b/configure.in
@@ -15,7 +15,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
dnl Process this file with autoconf to produce a configure script.
-AC_REVISION($Revision: 7881 $)
+AC_REVISION($Revision: 7882 $)
AC_PREREQ(2.0)
AC_INIT(src/common.h)
@@ -609,8 +609,6 @@ bin/fix_url.py \
bin/genaliases \
bin/inject \
bin/list_admins \
-bin/list_lists \
-bin/list_members \
bin/list_owners \
bin/mailmanctl \
bin/mmshell \