summaryrefslogtreecommitdiff
path: root/src/mailman/commands
diff options
context:
space:
mode:
authorBarry Warsaw2011-01-01 11:28:29 -0500
committerBarry Warsaw2011-01-01 11:28:29 -0500
commit3f1f5a2826feb9c5fb202ae266ba7f0ff76ebe21 (patch)
tree1bab06750e306942180b18383c06ad2804f98677 /src/mailman/commands
parentd0f8e9e03d3c55641165b73a4d8971ec514a9cdc (diff)
downloadmailman-3f1f5a2826feb9c5fb202ae266ba7f0ff76ebe21.tar.gz
mailman-3f1f5a2826feb9c5fb202ae266ba7f0ff76ebe21.tar.zst
mailman-3f1f5a2826feb9c5fb202ae266ba7f0ff76ebe21.zip
Because it was just to damn confusing, rename IAddress.address to
IAddress.email and IAddress.original_address to IAddress.original_email. From now on we'll use "address" to talk about the IAddress object and "email" to talk about the textual email address.
Diffstat (limited to 'src/mailman/commands')
-rw-r--r--src/mailman/commands/cli_members.py10
-rw-r--r--src/mailman/commands/docs/create.txt16
-rw-r--r--src/mailman/commands/docs/members.txt46
-rw-r--r--src/mailman/commands/docs/membership.txt2
-rw-r--r--src/mailman/commands/eml_membership.py20
5 files changed, 55 insertions, 39 deletions
diff --git a/src/mailman/commands/cli_members.py b/src/mailman/commands/cli_members.py
index e18b4b686..e3159a589 100644
--- a/src/mailman/commands/cli_members.py
+++ b/src/mailman/commands/cli_members.py
@@ -156,21 +156,21 @@ class Members:
if len(addresses) == 0:
print >> fp, mlist.fqdn_listname, 'has no members'
return
- for address in sorted(addresses, key=attrgetter('address')):
+ for address in sorted(addresses, key=attrgetter('email')):
if args.regular:
- member = mlist.members.get_member(address.address)
+ member = mlist.members.get_member(address.email)
if member.delivery_mode != DeliveryMode.regular:
continue
if args.digest is not None:
- member = mlist.members.get_member(address.address)
+ member = mlist.members.get_member(address.email)
if member.delivery_mode not in digest_types:
continue
if args.nomail is not None:
- member = mlist.members.get_member(address.address)
+ member = mlist.members.get_member(address.email)
if member.delivery_status not in status_types:
continue
print >> fp, formataddr(
- (address.real_name, address.original_address))
+ (address.real_name, address.original_email))
finally:
if fp is not sys.stdout:
fp.close()
diff --git a/src/mailman/commands/docs/create.txt b/src/mailman/commands/docs/create.txt
index 70fb44d8f..31663a851 100644
--- a/src/mailman/commands/docs/create.txt
+++ b/src/mailman/commands/docs/create.txt
@@ -77,8 +77,8 @@ Setting the owner
By default, no list owners are specified.
- >>> print list(mlist.owners.addresses)
- []
+ >>> dump_list(mlist.owners.addresses)
+ *Empty*
But you can specify an owner address on the command line when you create the
mailing list.
@@ -91,8 +91,8 @@ mailing list.
Created mailing list: test4@example.com
>>> mlist = list_manager.get('test4@example.com')
- >>> print list(mlist.owners.addresses)
- [<Address: foo@example.org [not verified] at ...>]
+ >>> dump_list(repr(address) for address in mlist.owners.addresses)
+ <Address: foo@example.org [not verified] at ...>
You can even specify more than one address for the owners.
::
@@ -104,10 +104,10 @@ You can even specify more than one address for the owners.
>>> mlist = list_manager.get('test5@example.com')
>>> from operator import attrgetter
- >>> print sorted(mlist.owners.addresses, key=attrgetter('address'))
- [<Address: bar@example.net [not verified] at ...>,
- <Address: baz@example.net [not verified] at ...>,
- <Address: foo@example.net [not verified] at ...>]
+ >>> dump_list(repr(address) for address in mlist.owners.addresses)
+ <Address: bar@example.net [not verified] at ...>
+ <Address: baz@example.net [not verified] at ...>
+ <Address: foo@example.net [not verified] at ...>
Setting the language
diff --git a/src/mailman/commands/docs/members.txt b/src/mailman/commands/docs/members.txt
index 602e1bbe5..18a916781 100644
--- a/src/mailman/commands/docs/members.txt
+++ b/src/mailman/commands/docs/members.txt
@@ -205,8 +205,6 @@ need a file containing email addresses and full names that can be parsed by
::
>>> mlist2 = create_list('test2@example.com')
- >>> addresses = [
- ... ]
>>> import os
>>> path = os.path.join(config.VAR_DIR, 'addresses.txt')
@@ -221,8 +219,11 @@ need a file containing email addresses and full names that can be parsed by
>>> args.listname = [mlist2.fqdn_listname]
>>> command.process(args)
- >>> sorted(address.address for address in mlist2.members.addresses)
- [u'aperson@example.com', u'bperson@example.com', u'cperson@example.com']
+ >>> from operator import attrgetter
+ >>> dump_list(mlist2.members.addresses, key=attrgetter('email'))
+ aperson@example.com
+ Bart Person <bperson@example.com>
+ Cate Person <cperson@example.com>
You can also specify ``-`` as the filename, in which case the addresses are
taken from standard input.
@@ -244,9 +245,13 @@ taken from standard input.
>>> command.process(args)
>>> sys.stdin = sys.__stdin__
- >>> sorted(address.address for address in mlist2.members.addresses)
- [u'aperson@example.com', u'bperson@example.com', u'cperson@example.com',
- u'dperson@example.com', u'eperson@example.com', u'fperson@example.com']
+ >>> dump_list(mlist2.members.addresses, key=attrgetter('email'))
+ 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>
Blank lines and lines that begin with '#' are ignored.
::
@@ -262,10 +267,15 @@ Blank lines and lines that begin with '#' are ignored.
>>> args.input_filename = path
>>> command.process(args)
- >>> sorted(address.address for address in mlist2.members.addresses)
- [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']
+ >>> dump_list(mlist2.members.addresses, key=attrgetter('email'))
+ 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
Addresses which are already subscribed are ignored, although a warning is
printed.
@@ -282,10 +292,16 @@ printed.
Already subscribed (skipping): gperson@example.com
Already subscribed (skipping): aperson@example.com
- >>> sorted(address.address for address in mlist2.members.addresses)
- [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']
+ >>> dump_list(mlist2.members.addresses, key=attrgetter('email'))
+ 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
Displaying members
diff --git a/src/mailman/commands/docs/membership.txt b/src/mailman/commands/docs/membership.txt
index 3d611a160..0da7ffadf 100644
--- a/src/mailman/commands/docs/membership.txt
+++ b/src/mailman/commands/docs/membership.txt
@@ -281,7 +281,7 @@ to unsubscribe Anne from the alpha mailing list.
>>> print unicode(results)
The results of your email command are provided below.
<BLANKLINE>
- Invalid or unverified address: anne.person@example.org
+ Invalid or unverified email address: anne.person@example.org
<BLANKLINE>
>>> print mlist.members.get_member('anne@example.com')
diff --git a/src/mailman/commands/eml_membership.py b/src/mailman/commands/eml_membership.py
index 26d96ce3c..7da742b39 100644
--- a/src/mailman/commands/eml_membership.py
+++ b/src/mailman/commands/eml_membership.py
@@ -144,36 +144,36 @@ class Leave:
def process(self, mlist, msg, msgdata, arguments, results):
"""See `IEmailCommand`."""
- address = msg.sender
- if not address:
+ email = msg.sender
+ if not email:
print >> results, _(
- '$self.name: No valid address found to unsubscribe')
+ '$self.name: No valid email address found to unsubscribe')
return ContinueProcessing.no
user_manager = getUtility(IUserManager)
- user = user_manager.get_user(address)
+ user = user_manager.get_user(email)
if user is None:
- print >> results, _('No registered user for address: $address')
+ print >> results, _('No registered user for email address: $email')
return ContinueProcessing.no
# The address that the -leave command was sent from, must be verified.
# Otherwise you could link a bogus address to anyone's account, and
# then send a leave command from that address.
- if user_manager.get_address(address).verified_on is None:
- print >> results, _('Invalid or unverified address: $address')
+ if user_manager.get_address(email).verified_on is None:
+ print >> results, _('Invalid or unverified email address: $email')
return ContinueProcessing.no
for user_address in user.addresses:
# Only recognize verified addresses.
if user_address.verified_on is None:
continue
- member = mlist.members.get_member(user_address.address)
+ member = mlist.members.get_member(user_address.email)
if member is not None:
break
else:
# None of the user's addresses are subscribed to this mailing list.
print >> results, _(
- '$self.name: $address is not a member of $mlist.fqdn_listname')
+ '$self.name: $email is not a member of $mlist.fqdn_listname')
return ContinueProcessing.no
member.unsubscribe()
- person = formataddr((user.real_name, address))
+ person = formataddr((user.real_name, email))
print >> results, _('$person left $mlist.fqdn_listname')
return ContinueProcessing.yes