summaryrefslogtreecommitdiff
path: root/src/mailman
diff options
context:
space:
mode:
authorBarry Warsaw2009-11-28 13:40:20 -0500
committerBarry Warsaw2009-11-28 13:40:20 -0500
commit5f799a91a16e54f8d7f6333b49a7674b92cc204a (patch)
tree0511c7a3a189ae7ac7b5aaec4d34aa91f4341e09 /src/mailman
parent8abd5523521aaf15d53d64056212df8ad94474af (diff)
downloadmailman-5f799a91a16e54f8d7f6333b49a7674b92cc204a.tar.gz
mailman-5f799a91a16e54f8d7f6333b49a7674b92cc204a.tar.zst
mailman-5f799a91a16e54f8d7f6333b49a7674b92cc204a.zip
When no arguments are given to 'bin/members', print a list of all the mailing
list's member addresses and real names. Change the default LMTP server port to 8024, since 24 is the default (for postfix) but we don't want to require root.
Diffstat (limited to 'src/mailman')
-rw-r--r--src/mailman/commands/cli_members.py12
-rw-r--r--src/mailman/commands/docs/members.txt18
-rw-r--r--src/mailman/config/schema.cfg2
3 files changed, 28 insertions, 4 deletions
diff --git a/src/mailman/commands/cli_members.py b/src/mailman/commands/cli_members.py
index 213bb7a2c..d407a9e87 100644
--- a/src/mailman/commands/cli_members.py
+++ b/src/mailman/commands/cli_members.py
@@ -28,7 +28,8 @@ __all__ = [
import sys
import codecs
-from email.utils import parseaddr
+from email.utils import formataddr, parseaddr
+from operator import attrgetter
from zope.component import getUtility
from zope.interface import implements
@@ -42,7 +43,7 @@ from mailman.interfaces.member import AlreadySubscribedError, DeliveryMode
class Members:
- """Manage list memberships"""
+ """Manage list memberships. With no arguments, list all members."""
implements(ICLISubCommand)
@@ -74,7 +75,12 @@ class Members:
mlist = getUtility(IListManager).get(fqdn_listname)
if mlist is None:
self.parser.error(_('No such list: $fqdn_listname'))
- if args.filename == '-':
+ if args.filename is None:
+ for address in sorted(mlist.members.addresses,
+ key=attrgetter('address')):
+ print formataddr((address.real_name, address.original_address))
+ return
+ elif args.filename == '-':
fp = sys.stdin
else:
fp = codecs.open(args.filename, 'r', 'utf-8')
diff --git a/src/mailman/commands/docs/members.txt b/src/mailman/commands/docs/members.txt
index aea76dad8..e7fbd9c8e 100644
--- a/src/mailman/commands/docs/members.txt
+++ b/src/mailman/commands/docs/members.txt
@@ -94,3 +94,21 @@ printed.
[u'aperson@example.com', u'bperson@example.com', u'cperson@example.com',
u'dperson@example.com', u'eperson@example.com', u'fperson@example.com',
u'gperson@example.com', u'iperson@example.com', u'jperson@example.com']
+
+
+Displaying members
+==================
+
+With no arguments, the command displays all members of the list.
+
+ >>> args.filename = None
+ >>> command.process(args)
+ aperson@example.com
+ Bart Person <bperson@example.com>
+ Cate Person <cperson@example.com>
+ dperson@example.com
+ Elly Person <eperson@example.com>
+ Fred Person <fperson@example.com>
+ gperson@example.com
+ iperson@example.com
+ jperson@example.com
diff --git a/src/mailman/config/schema.cfg b/src/mailman/config/schema.cfg
index 36e736345..89898f441 100644
--- a/src/mailman/config/schema.cfg
+++ b/src/mailman/config/schema.cfg
@@ -286,7 +286,7 @@ smtp_port: 25
# Where the LMTP server listens for connections.
lmtp_host: localhost
-lmtp_port: 8025
+lmtp_port: 8024
# Ceiling on the number of recipients that can be specified in a single SMTP
# transaction. Set to 0 to submit the entire recipient list in one