summaryrefslogtreecommitdiff
path: root/src/mailman/model/docs
diff options
context:
space:
mode:
authorBarry Warsaw2014-04-28 11:23:35 -0400
committerBarry Warsaw2014-04-28 11:23:35 -0400
commitd4d71f71f08d6d440b17482eecc5472dcfe6cbae (patch)
tree71f08b3d60f698883294eaa6d1bf366a095da011 /src/mailman/model/docs
parent7536530dcd8d6303c0a869e8c9c2cb2517b9b018 (diff)
downloadmailman-d4d71f71f08d6d440b17482eecc5472dcfe6cbae.tar.gz
mailman-d4d71f71f08d6d440b17482eecc5472dcfe6cbae.tar.zst
mailman-d4d71f71f08d6d440b17482eecc5472dcfe6cbae.zip
Use print functions consistently through, and update all __future__ imports to
reflect this. Also, mock out sys.stderr on some tests so that their nose2 output is quieter. A few other minor coding style consistencies.
Diffstat (limited to 'src/mailman/model/docs')
-rw-r--r--src/mailman/model/docs/addresses.rst38
-rw-r--r--src/mailman/model/docs/autorespond.rst2
-rw-r--r--src/mailman/model/docs/bounce.rst16
-rw-r--r--src/mailman/model/docs/domains.rst22
-rw-r--r--src/mailman/model/docs/languages.rst20
-rw-r--r--src/mailman/model/docs/listmanager.rst24
-rw-r--r--src/mailman/model/docs/mailinglist.rst24
-rw-r--r--src/mailman/model/docs/membership.rst28
-rw-r--r--src/mailman/model/docs/messagestore.rst16
-rw-r--r--src/mailman/model/docs/mlist-addresses.rst26
-rw-r--r--src/mailman/model/docs/pending.rst8
-rw-r--r--src/mailman/model/docs/registration.rst22
-rw-r--r--src/mailman/model/docs/requests.rst14
-rw-r--r--src/mailman/model/docs/usermanager.rst16
-rw-r--r--src/mailman/model/docs/users.rst36
15 files changed, 156 insertions, 156 deletions
diff --git a/src/mailman/model/docs/addresses.rst b/src/mailman/model/docs/addresses.rst
index b29ae658b..795afe43c 100644
--- a/src/mailman/model/docs/addresses.rst
+++ b/src/mailman/model/docs/addresses.rst
@@ -29,7 +29,7 @@ Creating an unlinked email address is straightforward.
However, such addresses have no real name.
- >>> print address_1.display_name
+ >>> print(address_1.display_name)
<BLANKLINE>
You can also create an email address object with a real name.
@@ -46,9 +46,9 @@ You can also create an email address object with a real name.
The ``str()`` of the address is the RFC 2822 preferred originator format,
while the ``repr()`` carries more information.
- >>> print str(address_2)
+ >>> print(str(address_2))
Ben Person <bperson@example.com>
- >>> print repr(address_2)
+ >>> print(repr(address_2))
<Address: Ben Person <bperson@example.com> [not verified] at 0x...>
You can assign real names to existing addresses.
@@ -61,9 +61,9 @@ You can assign real names to existing addresses.
These addresses are not linked to users, and can be seen by searching the user
manager for an associated user.
- >>> print user_manager.get_user('aperson@example.com')
+ >>> print(user_manager.get_user('aperson@example.com'))
None
- >>> print user_manager.get_user('bperson@example.com')
+ >>> print(user_manager.get_user('bperson@example.com'))
None
You can create email addresses that are linked to users by using a different
@@ -84,9 +84,9 @@ interface.
And now you can find the associated user.
- >>> print user_manager.get_user('aperson@example.com')
+ >>> print(user_manager.get_user('aperson@example.com'))
None
- >>> print user_manager.get_user('bperson@example.com')
+ >>> print(user_manager.get_user('bperson@example.com'))
None
>>> user_manager.get_user('cperson@example.com')
<User "Claire Person" (...) at ...>
@@ -131,9 +131,9 @@ but the latter must be set explicitly.
>>> address_4 = user_manager.create_address(
... 'dperson@example.com', 'Dan Person')
- >>> print address_4.registered_on
+ >>> print(address_4.registered_on)
2005-08-01 07:49:23
- >>> print address_4.verified_on
+ >>> print(address_4.verified_on)
None
The verification date records when the user has completed a mail-back
@@ -141,7 +141,7 @@ verification procedure. It takes a datetime object.
>>> from mailman.utilities.datetime import now
>>> address_4.verified_on = now()
- >>> print address_4.verified_on
+ >>> print(address_4.verified_on)
2005-08-01 07:49:23
The address shows the verified status in its representation.
@@ -160,7 +160,7 @@ An event is triggered when the address gets verified.
>>> from mailman.testing.helpers import event_subscribers
>>> with event_subscribers(save_event):
... address_5.verified_on = now()
- >>> print saved_event
+ >>> print(saved_event)
<AddressVerificationEvent eperson@example.com 2005-08-01 07:49:23>
An event is also triggered when the address is unverified. In this case,
@@ -169,9 +169,9 @@ address is being unverified.
>>> with event_subscribers(save_event):
... address_5.verified_on = None
- >>> print saved_event
+ >>> print(saved_event)
<AddressVerificationEvent eperson@example.com unverified>
- >>> print saved_event.address.verified_on
+ >>> print(saved_event.address.verified_on)
None
@@ -190,18 +190,18 @@ The str() of such an address prints the RFC 2822 preferred originator format
with the original case-preserved address. The repr() contains all the gory
details.
- >>> print str(address_6)
+ >>> print(str(address_6))
Frank Person <FPERSON@example.com>
- >>> print repr(address_6)
+ >>> print(repr(address_6))
<Address: Frank Person <FPERSON@example.com> [not verified]
key: fperson@example.com at 0x...>
Both the case-insensitive version of the address and the original
case-preserved version are available on attributes of the `IAddress` object.
- >>> print address_6.email
+ >>> print(address_6.email)
fperson@example.com
- >>> print address_6.original_email
+ >>> print(address_6.original_email)
FPERSON@example.com
Because addresses are case-insensitive for all other purposes, you cannot
@@ -223,7 +223,7 @@ create an address that differs only in case.
You can get the address using either the lower cased version or case-preserved
version. In fact, searching for an address is case insensitive.
- >>> print user_manager.get_address('fperson@example.com').email
+ >>> print(user_manager.get_address('fperson@example.com').email)
fperson@example.com
- >>> print user_manager.get_address('FPERSON@example.com').email
+ >>> print(user_manager.get_address('FPERSON@example.com').email)
fperson@example.com
diff --git a/src/mailman/model/docs/autorespond.rst b/src/mailman/model/docs/autorespond.rst
index b2bf03ed9..6210e48cb 100644
--- a/src/mailman/model/docs/autorespond.rst
+++ b/src/mailman/model/docs/autorespond.rst
@@ -112,5 +112,5 @@ If there's been no response sent to a particular address, None is returned.
... 'bperson@example.com')
>>> response_set.todays_count(address, Response.command)
0
- >>> print response_set.last_response(address, Response.command)
+ >>> print(response_set.last_response(address, Response.command))
None
diff --git a/src/mailman/model/docs/bounce.rst b/src/mailman/model/docs/bounce.rst
index f427689bd..c5123fdef 100644
--- a/src/mailman/model/docs/bounce.rst
+++ b/src/mailman/model/docs/bounce.rst
@@ -39,16 +39,16 @@ of bouncing email addresses. These are passed one-by-one to the registration
interface.
>>> event = processor.register(mlist, 'anne@example.com', msg)
- >>> print event.list_id
+ >>> print(event.list_id)
test.example.com
- >>> print event.email
+ >>> print(event.email)
anne@example.com
- >>> print event.message_id
+ >>> print(event.message_id)
<first>
Bounce events have a timestamp.
- >>> print event.timestamp
+ >>> print(event.timestamp)
2005-08-01 07:49:23
Bounce events have a flag indicating whether they've been processed or not.
@@ -68,9 +68,9 @@ When a bounce is registered, you can indicate the bounce context.
If no context is given, then a default one is used.
>>> event = processor.register(mlist, 'bart@example.com', msg)
- >>> print event.message_id
+ >>> print(event.message_id)
<second>
- >>> print event.context
+ >>> print(event.context)
BounceContext.normal
A probe bounce carries more weight than just a normal bounce.
@@ -78,7 +78,7 @@ A probe bounce carries more weight than just a normal bounce.
>>> from mailman.interfaces.bounce import BounceContext
>>> event = processor.register(
... mlist, 'bart@example.com', msg, BounceContext.probe)
- >>> print event.message_id
+ >>> print(event.message_id)
<second>
- >>> print event.context
+ >>> print(event.context)
BounceContext.probe
diff --git a/src/mailman/model/docs/domains.rst b/src/mailman/model/docs/domains.rst
index 878e5835a..153f6c19d 100644
--- a/src/mailman/model/docs/domains.rst
+++ b/src/mailman/model/docs/domains.rst
@@ -16,10 +16,10 @@ Domains are how Mailman interacts with email host names and web host names.
>>> from operator import attrgetter
>>> def show_domains():
... if len(manager) == 0:
- ... print 'no domains'
+ ... print('no domains')
... return
... for domain in sorted(manager, key=attrgetter('mail_host')):
- ... print domain
+ ... print(domain)
>>> show_domains()
no domains
@@ -77,9 +77,9 @@ Domains can list all associated mailing lists with the mailing_lists property.
>>> def show_lists(domain):
... mlists = list(domain.mailing_lists)
... for mlist in mlists:
- ... print mlist
+ ... print(mlist)
... if len(mlists) == 0:
- ... print 'no lists'
+ ... print('no lists')
>>> net_domain = manager['example.net']
>>> com_domain = manager['example.com']
@@ -99,16 +99,16 @@ In the global domain manager, domains are indexed by their email host name.
::
>>> for domain in sorted(manager, key=attrgetter('mail_host')):
- ... print domain.mail_host
+ ... print(domain.mail_host)
example.com
example.net
- >>> print manager['example.net']
+ >>> print(manager['example.net'])
<Domain example.net, The example domain,
base_url: http://lists.example.net,
contact_address: postmaster@example.com>
- >>> print manager['doesnotexist.com']
+ >>> print(manager['doesnotexist.com'])
Traceback (most recent call last):
...
KeyError: u'doesnotexist.com'
@@ -117,15 +117,15 @@ As with a dictionary, you can also get the domain. If the domain does not
exist, ``None`` or a default is returned.
::
- >>> print manager.get('example.net')
+ >>> print(manager.get('example.net'))
<Domain example.net, The example domain,
base_url: http://lists.example.net,
contact_address: postmaster@example.com>
- >>> print manager.get('doesnotexist.com')
+ >>> print(manager.get('doesnotexist.com'))
None
- >>> print manager.get('doesnotexist.com', 'blahdeblah')
+ >>> print(manager.get('doesnotexist.com', 'blahdeblah'))
blahdeblah
Non-existent domains cannot be removed.
@@ -143,5 +143,5 @@ Confirmation tokens can be added to the domain's url to generate the URL to a
page users can use to confirm their subscriptions.
>>> domain = manager['example.net']
- >>> print domain.confirm_url('abc')
+ >>> print(domain.confirm_url('abc'))
http://lists.example.net/confirm/abc
diff --git a/src/mailman/model/docs/languages.rst b/src/mailman/model/docs/languages.rst
index 06af71417..fedea0e6e 100644
--- a/src/mailman/model/docs/languages.rst
+++ b/src/mailman/model/docs/languages.rst
@@ -44,13 +44,13 @@ used by the language. The language object is returned.
And you can get information for all known languages.
- >>> print mgr['en'].description
+ >>> print(mgr['en'].description)
English
- >>> print mgr['en'].charset
+ >>> print(mgr['en'].charset)
us-ascii
- >>> print mgr['it'].description
+ >>> print(mgr['it'].description)
Italian
- >>> print mgr['it'].charset
+ >>> print(mgr['it'].charset)
iso-8859-1
@@ -70,7 +70,7 @@ You can iterate over all the known languages.
>>> languages = sorted((language for language in mgr.languages),
... key=attrgetter('code'))
>>> for language in languages:
- ... print language.code, language.charset, language.description
+ ... print(language.code, language.charset, language.description)
en us-ascii English
it iso-8859-1 Italian
pl iso-8859-2 Polish
@@ -84,17 +84,17 @@ You can ask whether a particular language code is known.
You can get a particular language by its code.
- >>> print mgr['it'].description
+ >>> print(mgr['it'].description)
Italian
- >>> print mgr['xx'].code
+ >>> print(mgr['xx'].code)
Traceback (most recent call last):
...
KeyError: u'xx'
- >>> print mgr.get('it').description
+ >>> print(mgr.get('it').description)
Italian
- >>> print mgr.get('xx')
+ >>> print(mgr.get('xx'))
None
- >>> print mgr.get('xx', 'missing')
+ >>> print(mgr.get('xx', 'missing'))
missing
diff --git a/src/mailman/model/docs/listmanager.rst b/src/mailman/model/docs/listmanager.rst
index 41450b15d..151bee1fe 100644
--- a/src/mailman/model/docs/listmanager.rst
+++ b/src/mailman/model/docs/listmanager.rst
@@ -25,13 +25,13 @@ listname, and an `RFC 2369`_ list id. This latter will not change even if the
mailing list moves to a different host, so it is what uniquely distinguishes
the mailing list to the system.
- >>> print mlist.list_name
+ >>> print(mlist.list_name)
test
- >>> print mlist.mail_host
+ >>> print(mlist.mail_host)
example.com
- >>> print mlist.fqdn_listname
+ >>> print(mlist.fqdn_listname)
test@example.com
- >>> print mlist.list_id
+ >>> print(mlist.list_id)
test.example.com
If you try to create a mailing list with the same name as an existing list,
@@ -63,7 +63,7 @@ Use the list manager to delete a mailing list.
After deleting the list, you can create it again.
>>> mlist = list_manager.create('test@example.com')
- >>> print mlist.fqdn_listname
+ >>> print(mlist.fqdn_listname)
test@example.com
@@ -85,14 +85,14 @@ You can also get a mailing list by it's list id.
If you try to get a list that doesn't existing yet, you get ``None``.
- >>> print list_manager.get('test_2@example.com')
+ >>> print(list_manager.get('test_2@example.com'))
None
- >>> print list_manager.get_by_list_id('test_2.example.com')
+ >>> print(list_manager.get_by_list_id('test_2.example.com'))
None
You also get ``None`` if the list name is invalid.
- >>> print list_manager.get('foo')
+ >>> print(list_manager.get('foo'))
None
@@ -108,26 +108,26 @@ address components.
>>> mlist_4 = list_manager.create('test_4@example.com')
>>> for name in sorted(list_manager.names):
- ... print name
+ ... print(name)
test@example.com
test_3@example.com
test_4@example.com
>>> for list_id in sorted(list_manager.list_ids):
- ... print list_id
+ ... print(list_id)
test.example.com
test_3.example.com
test_4.example.com
>>> for fqdn_listname in sorted(m.fqdn_listname
... for m in list_manager.mailing_lists):
- ... print fqdn_listname
+ ... print(fqdn_listname)
test@example.com
test_3@example.com
test_4@example.com
>>> for list_name, mail_host in sorted(list_manager.name_components):
- ... print list_name, '@', mail_host
+ ... print(list_name, '@', mail_host)
test @ example.com
test_3 @ example.com
test_4 @ example.com
diff --git a/src/mailman/model/docs/mailinglist.rst b/src/mailman/model/docs/mailinglist.rst
index 21c2f0fd8..53ba99575 100644
--- a/src/mailman/model/docs/mailinglist.rst
+++ b/src/mailman/model/docs/mailinglist.rst
@@ -10,17 +10,17 @@ i.e. the email address you would send a message to in order to post a message
to the mailing list. The list id is defined in `RFC 2369`_.
>>> mlist = create_list('aardvark@example.com')
- >>> print mlist.list_id
+ >>> print(mlist.list_id)
aardvark.example.com
- >>> print mlist.fqdn_listname
+ >>> print(mlist.fqdn_listname)
aardvark@example.com
The mailing list also has convenient attributes for accessing the list's short
name (i.e. local part) and host name.
- >>> print mlist.list_name
+ >>> print(mlist.list_name)
aardvark
- >>> print mlist.mail_host
+ >>> print(mlist.mail_host)
example.com
@@ -51,7 +51,7 @@ receive a copy of any message sent to the mailing list.
Both addresses appear on the roster of members.
>>> for member in mlist.members.members:
- ... print member
+ ... print(member)
<Member: aperson@example.com on aardvark@example.com as MemberRole.member>
<Member: bperson@example.com on aardvark@example.com as MemberRole.member>
@@ -73,12 +73,12 @@ an owner and a moderator.
::
>>> for member in mlist.owners.members:
- ... print member
+ ... print(member)
<Member: aperson@example.com on aardvark@example.com as MemberRole.owner>
<Member: cperson@example.com on aardvark@example.com as MemberRole.owner>
>>> for member in mlist.moderators.members:
- ... print member
+ ... print(member)
<Member: cperson@example.com on aardvark@example.com
as MemberRole.moderator>
@@ -88,19 +88,19 @@ All rosters can also be accessed indirectly.
>>> roster = mlist.get_roster(MemberRole.member)
>>> for member in roster.members:
- ... print member
+ ... print(member)
<Member: aperson@example.com on aardvark@example.com as MemberRole.member>
<Member: bperson@example.com on aardvark@example.com as MemberRole.member>
>>> roster = mlist.get_roster(MemberRole.owner)
>>> for member in roster.members:
- ... print member
+ ... print(member)
<Member: aperson@example.com on aardvark@example.com as MemberRole.owner>
<Member: cperson@example.com on aardvark@example.com as MemberRole.owner>
>>> roster = mlist.get_roster(MemberRole.moderator)
>>> for member in roster.members:
- ... print member
+ ... print(member)
<Member: cperson@example.com on aardvark@example.com
as MemberRole.moderator>
@@ -123,7 +123,7 @@ just by changing their preferred address.
<Member: Dave Person <dperson@example.com> on aardvark@example.com
as MemberRole.member>
>>> for member in mlist.members.members:
- ... print member
+ ... print(member)
<Member: aperson@example.com on aardvark@example.com as MemberRole.member>
<Member: bperson@example.com on aardvark@example.com as MemberRole.member>
<Member: Dave Person <dperson@example.com> on aardvark@example.com
@@ -134,7 +134,7 @@ just by changing their preferred address.
>>> user.preferred_address = new_address
>>> for member in mlist.members.members:
- ... print member
+ ... print(member)
<Member: aperson@example.com on aardvark@example.com as MemberRole.member>
<Member: bperson@example.com on aardvark@example.com as MemberRole.member>
<Member: dave.person@example.com on aardvark@example.com
diff --git a/src/mailman/model/docs/membership.rst b/src/mailman/model/docs/membership.rst
index eeba9b332..2a6c99fc0 100644
--- a/src/mailman/model/docs/membership.rst
+++ b/src/mailman/model/docs/membership.rst
@@ -43,7 +43,7 @@ in the user database yet.
>>> from zope.component import getUtility
>>> user_manager = getUtility(IUserManager)
>>> user_1 = user_manager.create_user('aperson@example.com', 'Anne Person')
- >>> print user_1
+ >>> print(user_1)
<User "Anne Person" (...) at ...>
We can add Anne as an owner of the mailing list, by creating a member role for
@@ -70,7 +70,7 @@ her a moderator. Nor does it make her a member of the list.
Bart becomes a moderator of the list.
>>> user_2 = user_manager.create_user('bperson@example.com', 'Bart Person')
- >>> print user_2
+ >>> print(user_2)
<User "Bart Person" (...) at ...>
>>> address_2 = list(user_2.addresses)[0]
>>> mlist.subscribe(address_2, MemberRole.moderator)
@@ -200,13 +200,13 @@ text email address by using the ``IRoster.get_member()`` method.
However, if the address is not subscribed with the appropriate role, then None
is returned.
- >>> print mlist.administrators.get_member('zperson@example.com')
+ >>> print(mlist.administrators.get_member('zperson@example.com'))
None
- >>> print mlist.moderators.get_member('aperson@example.com')
+ >>> print(mlist.moderators.get_member('aperson@example.com'))
None
- >>> print mlist.members.get_member('zperson@example.com')
+ >>> print(mlist.members.get_member('zperson@example.com'))
None
- >>> print mlist.nonmembers.get_member('aperson@example.com')
+ >>> print(mlist.nonmembers.get_member('aperson@example.com'))
None
@@ -219,7 +219,7 @@ regardless of their role.
>>> def sortkey(member):
... return (member.address.email, member.role.value)
>>> for member in sorted(mlist.subscribers.members, key=sortkey):
- ... print member.address.email, member.role
+ ... print(member.address.email, member.role)
aperson@example.com MemberRole.member
aperson@example.com MemberRole.owner
bperson@example.com MemberRole.member
@@ -249,7 +249,7 @@ automatically accepted for posting to the mailing list.
>>> for member in sorted(mlist.administrators.members,
... key=attrgetter('address.email')):
- ... print member.address.email, member.role, member.moderation_action
+ ... print(member.address.email, member.role, member.moderation_action)
aperson@example.com MemberRole.owner Action.accept
bperson@example.com MemberRole.moderator Action.accept
@@ -258,7 +258,7 @@ should go through the normal moderation checks.
>>> for member in sorted(mlist.members.members,
... key=attrgetter('address.email')):
- ... print member.address.email, member.role, member.moderation_action
+ ... print(member.address.email, member.role, member.moderation_action)
aperson@example.com MemberRole.member Action.defer
bperson@example.com MemberRole.member Action.defer
cperson@example.com MemberRole.member Action.defer
@@ -266,7 +266,7 @@ should go through the normal moderation checks.
Postings by nonmembers are held for moderator approval by default.
>>> for member in mlist.nonmembers.members:
- ... print member.address.email, member.role, member.moderation_action
+ ... print(member.address.email, member.role, member.moderation_action)
fperson@example.com MemberRole.nonmember Action.hold
@@ -283,7 +283,7 @@ though that the address their changing to must be verified.
>>> gwen_address = list(gwen.addresses)[0]
>>> gwen_member = bee.subscribe(gwen_address)
>>> for m in bee.members.members:
- ... print m.member_id.int, m.mailing_list.list_id, m.address.email
+ ... print(m.member_id.int, m.mailing_list.list_id, m.address.email)
7 bee.example.com gwen@example.com
Gwen gets a email address.
@@ -301,7 +301,7 @@ address, but the address is not yet verified.
Her membership has not changed.
>>> for m in bee.members.members:
- ... print m.member_id.int, m.mailing_list.list_id, m.address.email
+ ... print(m.member_id.int, m.mailing_list.list_id, m.address.email)
7 bee.example.com gwen@example.com
Gwen verifies her email address, and updates her membership.
@@ -313,7 +313,7 @@ Gwen verifies her email address, and updates her membership.
Now her membership reflects the new address.
>>> for m in bee.members.members:
- ... print m.member_id.int, m.mailing_list.list_id, m.address.email
+ ... print(m.member_id.int, m.mailing_list.list_id, m.address.email)
7 bee.example.com gperson@example.com
@@ -325,7 +325,7 @@ An event is triggered when a new member is subscribed to a mailing list.
>>> from mailman.testing.helpers import event_subscribers
>>> def handle_event(event):
- ... print event
+ ... print(event)
>>> cat = create_list('cat@example.com')
>>> herb = user_manager.create_address('herb@example.com')
diff --git a/src/mailman/model/docs/messagestore.rst b/src/mailman/model/docs/messagestore.rst
index 3ee59129b..4ddce7606 100644
--- a/src/mailman/model/docs/messagestore.rst
+++ b/src/mailman/model/docs/messagestore.rst
@@ -30,7 +30,7 @@ However, if the message has a ``Message-ID`` header, it can be stored.
>>> msg['Message-ID'] = '<87myycy5eh.fsf@uwakimon.sk.tsukuba.ac.jp>'
>>> message_store.add(msg)
'AGDWSNXXKCWEILKKNYTBOHRDQGOX3Y35'
- >>> print msg.as_string()
+ >>> print(msg.as_string())
Subject: An important message
Message-ID: <87myycy5eh.fsf@uwakimon.sk.tsukuba.ac.jp>
X-Message-ID-Hash: AGDWSNXXKCWEILKKNYTBOHRDQGOX3Y35
@@ -46,15 +46,15 @@ There are several ways to find a message given either the ``Message-ID`` or
``X-Message-ID-Hash`` headers. In either case, if no matching message is
found, ``None`` is returned.
- >>> print message_store.get_message_by_id('nothing')
+ >>> print(message_store.get_message_by_id('nothing'))
None
- >>> print message_store.get_message_by_hash('nothing')
+ >>> print(message_store.get_message_by_hash('nothing'))
None
Given an existing ``Message-ID``, the message can be found.
>>> message = message_store.get_message_by_id(msg['message-id'])
- >>> print message.as_string()
+ >>> print(message.as_string())
Subject: An important message
Message-ID: <87myycy5eh.fsf@uwakimon.sk.tsukuba.ac.jp>
X-Message-ID-Hash: AGDWSNXXKCWEILKKNYTBOHRDQGOX3Y35
@@ -65,7 +65,7 @@ Given an existing ``Message-ID``, the message can be found.
Similarly, we can find messages by the ``X-Message-ID-Hash``:
>>> message = message_store.get_message_by_hash(msg['x-message-id-hash'])
- >>> print message.as_string()
+ >>> print(message.as_string())
Subject: An important message
Message-ID: <87myycy5eh.fsf@uwakimon.sk.tsukuba.ac.jp>
X-Message-ID-Hash: AGDWSNXXKCWEILKKNYTBOHRDQGOX3Y35
@@ -83,7 +83,7 @@ contains.
>>> messages = list(message_store.messages)
>>> len(messages)
1
- >>> print messages[0].as_string()
+ >>> print(messages[0].as_string())
Subject: An important message
Message-ID: <87myycy5eh.fsf@uwakimon.sk.tsukuba.ac.jp>
X-Message-ID-Hash: AGDWSNXXKCWEILKKNYTBOHRDQGOX3Y35
@@ -110,7 +110,7 @@ But if you delete an existing message, it really gets deleted.
>>> message_store.delete_message(message_id)
>>> list(message_store.messages)
[]
- >>> print message_store.get_message_by_id(message_id)
+ >>> print(message_store.get_message_by_id(message_id))
None
- >>> print message_store.get_message_by_hash(message['x-message-id-hash'])
+ >>> print(message_store.get_message_by_hash(message['x-message-id-hash']))
None
diff --git a/src/mailman/model/docs/mlist-addresses.rst b/src/mailman/model/docs/mlist-addresses.rst
index 2a021f67f..d546b4962 100644
--- a/src/mailman/model/docs/mlist-addresses.rst
+++ b/src/mailman/model/docs/mlist-addresses.rst
@@ -10,48 +10,48 @@ These are defined in the ``IMailingListAddresses`` interface.
The posting address is where people send messages to be posted to the mailing
list. This is exactly the same as the fully qualified list name.
- >>> print mlist.fqdn_listname
+ >>> print(mlist.fqdn_listname)
_xtest@example.com
- >>> print mlist.posting_address
+ >>> print(mlist.posting_address)
_xtest@example.com
Messages to the mailing list's `no reply` address always get discarded without
prejudice.
- >>> print mlist.no_reply_address
+ >>> print(mlist.no_reply_address)
noreply@example.com
The mailing list's owner address reaches the human moderators.
- >>> print mlist.owner_address
+ >>> print(mlist.owner_address)
_xtest-owner@example.com
The request address goes to the list's email command robot.
- >>> print mlist.request_address
+ >>> print(mlist.request_address)
_xtest-request@example.com
The bounces address accepts and processes all potential bounces.
- >>> print mlist.bounces_address
+ >>> print(mlist.bounces_address)
_xtest-bounces@example.com
The join (a.k.a. subscribe) address is where someone can email to get added to
the mailing list. The subscribe alias is a synonym for join, but it's
deprecated.
- >>> print mlist.join_address
+ >>> print(mlist.join_address)
_xtest-join@example.com
- >>> print mlist.subscribe_address
+ >>> print(mlist.subscribe_address)
_xtest-subscribe@example.com
The leave (a.k.a. unsubscribe) address is where someone can email to get added
to the mailing list. The unsubscribe alias is a synonym for leave, but it's
deprecated.
- >>> print mlist.leave_address
+ >>> print(mlist.leave_address)
_xtest-leave@example.com
- >>> print mlist.unsubscribe_address
+ >>> print(mlist.unsubscribe_address)
_xtest-unsubscribe@example.com
@@ -64,15 +64,15 @@ included in the local part of the email address. The exact format of this is
dependent on the ``verp_confirm_format`` configuration variable.
::
- >>> print mlist.confirm_address('cookie')
+ >>> print(mlist.confirm_address('cookie'))
_xtest-confirm+cookie@example.com
- >>> print mlist.confirm_address('wookie')
+ >>> print(mlist.confirm_address('wookie'))
_xtest-confirm+wookie@example.com
>>> config.push('test config', """
... [mta]
... verp_confirm_format: $address---$cookie
... """)
- >>> print mlist.confirm_address('cookie')
+ >>> print(mlist.confirm_address('cookie'))
_xtest-confirm---cookie@example.com
>>> config.pop('test config')
diff --git a/src/mailman/model/docs/pending.rst b/src/mailman/model/docs/pending.rst
index 3d33dd5da..d8206b264 100644
--- a/src/mailman/model/docs/pending.rst
+++ b/src/mailman/model/docs/pending.rst
@@ -39,7 +39,7 @@ the database that matches the token. If the token isn't in the database, None
is returned.
>>> pendable = pendingdb.confirm(bytes('missing'))
- >>> print pendable
+ >>> print(pendable)
None
>>> pendable = pendingdb.confirm(token)
>>> dump_msgdata(pendable)
@@ -51,7 +51,7 @@ is returned.
After confirmation, the token is no longer in the database.
- >>> print pendingdb.confirm(token)
+ >>> print(pendingdb.confirm(token))
None
There are a few other things you can do with the pending database. When you
@@ -70,7 +70,7 @@ expunge it.
>>> pendable = pendingdb.confirm(token_1, expunge=True)
>>> dump_msgdata(pendable)
type: one
- >>> print pendingdb.confirm(token_1)
+ >>> print(pendingdb.confirm(token_1))
None
An event can be given a lifetime when it is pended, otherwise it just uses a
@@ -84,7 +84,7 @@ default lifetime.
Every once in a while the pending database is cleared of old records.
>>> pendingdb.evict()
- >>> print pendingdb.confirm(token_4)
+ >>> print(pendingdb.confirm(token_4))
None
>>> pendable = pendingdb.confirm(token_2)
>>> dump_msgdata(pendable)
diff --git a/src/mailman/model/docs/registration.rst b/src/mailman/model/docs/registration.rst
index 77cb75890..32ee27316 100644
--- a/src/mailman/model/docs/registration.rst
+++ b/src/mailman/model/docs/registration.rst
@@ -22,7 +22,7 @@ Here is a helper function to check the token strings.
... assert isinstance(token, basestring), 'Not a string'
... assert len(token) == 40, 'Unexpected length: %d' % len(token)
... assert token.isalnum(), 'Not alphanumeric'
- ... print 'ok'
+ ... print('ok')
Here is a helper function to extract tokens from confirmation messages.
@@ -90,9 +90,9 @@ There should be no records in the user manager for this address yet.
>>> from mailman.interfaces.usermanager import IUserManager
>>> from zope.component import getUtility
>>> user_manager = getUtility(IUserManager)
- >>> print user_manager.get_user('aperson@example.com')
+ >>> print(user_manager.get_user('aperson@example.com'))
None
- >>> print user_manager.get_address('aperson@example.com')
+ >>> print(user_manager.get_address('aperson@example.com'))
None
But this address is waiting for confirmation.
@@ -118,7 +118,7 @@ message is sent to the user in order to verify the registered address.
>>> items = get_queue_messages('virgin')
>>> len(items)
1
- >>> print items[0].msg.as_string()
+ >>> print(items[0].msg.as_string())
MIME-Version: 1.0
...
Subject: confirm ...
@@ -224,7 +224,7 @@ confirmation step is completed.
<Address: cperson@example.com [not verified] at ...>
>>> token = registrar.register(
... mlist, 'cperson@example.com', 'Claire Person')
- >>> print user_manager.get_user('cperson@example.com')
+ >>> print(user_manager.get_user('cperson@example.com'))
None
>>> items = get_queue_messages('virgin')
>>> len(items)
@@ -256,11 +256,11 @@ mind about registering. When discarded, no `IAddress` or `IUser` is created.
>>> check_token(token)
ok
>>> registrar.discard(token)
- >>> print pendingdb.confirm(token)
+ >>> print(pendingdb.confirm(token))
None
- >>> print user_manager.get_address('eperson@example.com')
+ >>> print(user_manager.get_address('eperson@example.com'))
None
- >>> print user_manager.get_user('eperson@example.com')
+ >>> print(user_manager.get_user('eperson@example.com'))
None
# Clear the virgin queue of all the preceding confirmation messages.
@@ -331,7 +331,7 @@ However, the pending event matched with that token will still be removed.
>>> token = pendingdb.add(pendable)
>>> registrar.confirm(token)
False
- >>> print pendingdb.confirm(token)
+ >>> print(pendingdb.confirm(token))
None
@@ -346,13 +346,13 @@ list.
Before confirmation, Fred is not a member of the mailing list.
- >>> print mlist.members.get_member('fred.person@example.com')
+ >>> print(mlist.members.get_member('fred.person@example.com'))
None
But after confirmation, he is.
>>> registrar.confirm(token)
True
- >>> print mlist.members.get_member('fred.person@example.com')
+ >>> print(mlist.members.get_member('fred.person@example.com'))
<Member: Fred Person <fred.person@example.com>
on alpha@example.com as MemberRole.member>
diff --git a/src/mailman/model/docs/requests.rst b/src/mailman/model/docs/requests.rst
index f911e8fbb..e99cef634 100644
--- a/src/mailman/model/docs/requests.rst
+++ b/src/mailman/model/docs/requests.rst
@@ -90,17 +90,17 @@ of the request data we want. This returns a 2-tuple of the key and data we
originally held.
>>> key, data = requests.get_request(2)
- >>> print key
+ >>> print(key)
hold_2
There was no additional data associated with request 2.
- >>> print data
+ >>> print(data)
None
If we ask for a request that is not in the database, we get None back.
- >>> print requests.get_request(801)
+ >>> print(requests.get_request(801))
None
@@ -118,7 +118,7 @@ The data is returned when the request is retrieved. The dictionary will have
an additional key which holds the name of the request type.
>>> key, data = requests.get_request(5)
- >>> print key
+ >>> print(key)
hold_5
>>> dump_msgdata(data)
_request_type: held_message
@@ -136,10 +136,10 @@ over by type.
3
>>> for request in requests.of_type(RequestType.held_message):
... key, data = requests.get_request(request.id)
- ... print request.id, request.request_type, key
+ ... print(request.id, request.request_type, key)
... if data is not None:
... for key in sorted(data):
- ... print ' {0}: {1}'.format(key, data[key])
+ ... print(' {0}: {1}'.format(key, data[key]))
1 RequestType.held_message hold_1
4 RequestType.held_message hold_4
5 RequestType.held_message hold_5
@@ -162,7 +162,7 @@ database.
Request 2 is no longer in the database.
- >>> print requests.get_request(2)
+ >>> print(requests.get_request(2))
None
>>> for request in requests.held_requests:
diff --git a/src/mailman/model/docs/usermanager.rst b/src/mailman/model/docs/usermanager.rst
index cf7672b27..9a8c35c00 100644
--- a/src/mailman/model/docs/usermanager.rst
+++ b/src/mailman/model/docs/usermanager.rst
@@ -26,14 +26,14 @@ have a password.
>>> dump_list(address.email for address in user.addresses)
*Empty*
- >>> print user.display_name
+ >>> print(user.display_name)
<BLANKLINE>
- >>> print user.password
+ >>> print(user.password)
None
The user has preferences, but none of them will be specified.
- >>> print user.preferences
+ >>> print(user.preferences)
<Preferences ...>
A user can be assigned a real name.
@@ -125,10 +125,10 @@ that the ``.get_user()`` method takes a string email address, not an
If the address is not in the user database or does not have a user associated
with it, you will get ``None`` back.
- >>> print user_manager.get_user('zperson@example.com')
+ >>> print(user_manager.get_user('zperson@example.com'))
None
>>> user_4.unlink(address)
- >>> print user_manager.get_user(address.email)
+ >>> print(user_manager.get_user(address.email))
None
Users can also be found by their unique user id.
@@ -144,7 +144,7 @@ Users can also be found by their unique user id.
If a non-existent user id is given, None is returned.
>>> from uuid import UUID
- >>> print user_manager.get_user_by_id(UUID(int=801))
+ >>> print(user_manager.get_user_by_id(UUID(int=801)))
None
@@ -173,8 +173,8 @@ There are now four members in the system. Sort them by address then role.
... return (member.address.email, member.role.name)
>>> members = sorted(user_manager.members, key=sort_key)
>>> for member in members:
- ... print member.mailing_list.list_id, member.address.email, \
- ... member.role
+ ... print(member.mailing_list.list_id, member.address.email,
+ ... member.role)
test.example.com bperson@example.com MemberRole.member
test.example.com bperson@example.com MemberRole.owner
test.example.com eperson@example.com MemberRole.member
diff --git a/src/mailman/model/docs/users.rst b/src/mailman/model/docs/users.rst
index 889fe46d1..2e7333944 100644
--- a/src/mailman/model/docs/users.rst
+++ b/src/mailman/model/docs/users.rst
@@ -45,14 +45,14 @@ When the user's password is changed, an event is triggered.
>>> from mailman.testing.helpers import event_subscribers
>>> with event_subscribers(save_event):
... user_1.password = b'changed again'
- >>> print saved_event
+ >>> print(saved_event)
<PasswordChangeEvent Zoe X. Person>
The event holds a reference to the `IUser` that changed their password.
- >>> print saved_event.user.display_name
+ >>> print(saved_event.user.display_name)
Zoe X. Person
- >>> print saved_event.user.password
+ >>> print(saved_event.user.password)
changed again
@@ -63,7 +63,7 @@ Although rarely visible to users, every user has a unique ID in Mailman, which
never changes. This ID is generated randomly at the time the user is created,
and is represented by a UUID.
- >>> print user_1.user_id
+ >>> print(user_1.user_id)
00000000-0000-0000-0000-000000000001
The user id cannot change.
@@ -76,7 +76,7 @@ The user id cannot change.
User records also have a date on which they where created.
# The test suite uses a predictable timestamp.
- >>> print user_1.created_on
+ >>> print(user_1.created_on)
2005-08-01 07:49:23
@@ -138,7 +138,7 @@ that address.
True
>>> user_manager.get_user('zperson@example.org') is user_1
True
- >>> print user_manager.get_user('bperson@example.com')
+ >>> print(user_manager.get_user('bperson@example.com'))
None
Addresses can also be unlinked from a user.
@@ -146,7 +146,7 @@ Addresses can also be unlinked from a user.
>>> user_1.unlink(address_1)
>>> user_1.controls('zperson@example.net')
False
- >>> print user_manager.get_user('aperson@example.net')
+ >>> print(user_manager.get_user('aperson@example.net'))
None
But don't try to unlink the address from a user it's not linked to.
@@ -173,14 +173,14 @@ change.
By default, a user has no preferred address.
>>> user_2 = user_manager.create_user()
- >>> print user_2.preferred_address
+ >>> print(user_2.preferred_address)
None
Even when a user registers an address, this address will not be set as the
preferred address.
>>> anne = user_2.register('anne@example.com', 'Anne Person')
- >>> print user_2.preferred_address
+ >>> print(user_2.preferred_address)
None
The preferred address must be explicitly registered, however only verified
@@ -233,7 +233,7 @@ A user can disavow their preferred address.
>>> user_2.preferred_address
<Address: aperson@example.com [verified] at ...>
>>> del user_2.preferred_address
- >>> print user_2.preferred_address
+ >>> print(user_2.preferred_address)
None
The preferred address always shows up in the set of addresses controlled by
@@ -241,7 +241,7 @@ this user.
>>> from operator import attrgetter
>>> for address in sorted(user_2.addresses, key=attrgetter('email')):
- ... print address.email
+ ... print(address.email)
anne@example.com
aperson@example.com
@@ -252,11 +252,11 @@ Users and preferences
This is a helper function for the following section.
>>> def show_prefs(prefs):
- ... print 'acknowledge_posts :', prefs.acknowledge_posts
- ... print 'preferred_language :', prefs.preferred_language
- ... print 'receive_list_copy :', prefs.receive_list_copy
- ... print 'receive_own_postings :', prefs.receive_own_postings
- ... print 'delivery_mode :', prefs.delivery_mode
+ ... print('acknowledge_posts :', prefs.acknowledge_posts)
+ ... print('preferred_language :', prefs.preferred_language)
+ ... print('receive_list_copy :', prefs.receive_list_copy)
+ ... print('receive_own_postings :', prefs.receive_own_postings)
+ ... print('delivery_mode :', prefs.delivery_mode)
Users have preferences, but these preferences have no default settings.
@@ -334,8 +334,8 @@ membership role.
>>> def sortkey(member):
... return member.address.email, member.mailing_list, member.role.value
>>> for member in sorted(members, key=sortkey):
- ... print member.address.email, member.mailing_list.list_id, \
- ... member.role
+ ... print(member.address.email, member.mailing_list.list_id,
+ ... member.role)
zperson@example.com xtest_1.example.com MemberRole.member
zperson@example.net xtest_3.example.com MemberRole.moderator
zperson@example.org xtest_2.example.com MemberRole.member