summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mailman/archiving/docs/common.txt2
-rw-r--r--src/mailman/commands/docs/echo.txt6
-rw-r--r--src/mailman/commands/docs/end.txt14
-rw-r--r--src/mailman/commands/docs/join.txt18
-rw-r--r--src/mailman/database/__init__.py2
-rw-r--r--src/mailman/docs/addresses.txt52
-rw-r--r--src/mailman/docs/autorespond.txt7
-rw-r--r--src/mailman/docs/bounces.txt4
-rw-r--r--src/mailman/docs/chains.txt2
-rw-r--r--src/mailman/docs/domains.txt34
-rw-r--r--src/mailman/docs/lifecycle.txt46
-rw-r--r--src/mailman/docs/listmanager.txt30
-rw-r--r--src/mailman/docs/membership.txt44
-rw-r--r--src/mailman/docs/message.txt2
-rw-r--r--src/mailman/docs/messagestore.txt6
-rw-r--r--src/mailman/docs/mlist-addresses.txt54
-rw-r--r--src/mailman/tests/test_documentation.py4
17 files changed, 164 insertions, 163 deletions
diff --git a/src/mailman/archiving/docs/common.txt b/src/mailman/archiving/docs/common.txt
index a97b14245..cde0ada73 100644
--- a/src/mailman/archiving/docs/common.txt
+++ b/src/mailman/archiving/docs/common.txt
@@ -6,7 +6,7 @@ Mailman supports pluggable archivers, and it comes with several default
archivers.
>>> from mailman.app.lifecycle import create_list
- >>> mlist = create_list(u'test@example.com')
+ >>> mlist = create_list('test@example.com')
>>> msg = message_from_string("""\
... From: aperson@example.org
... To: test@example.com
diff --git a/src/mailman/commands/docs/echo.txt b/src/mailman/commands/docs/echo.txt
index 95b50b523..31da2dfcb 100644
--- a/src/mailman/commands/docs/echo.txt
+++ b/src/mailman/commands/docs/echo.txt
@@ -9,13 +9,13 @@ to the sender.
'echo'
>>> command.argument_description
'[args]'
- >>> command.description
- u'Echo an acknowledgement. Arguments are return unchanged.'
+ >>> print command.description
+ Echo an acknowledgement. Arguments are return unchanged.
The original message is ignored, but the results receive the echoed command.
>>> from mailman.app.lifecycle import create_list
- >>> mlist = create_list(u'test@example.com')
+ >>> mlist = create_list('test@example.com')
>>> from mailman.queue.command import Results
>>> results = Results()
diff --git a/src/mailman/commands/docs/end.txt b/src/mailman/commands/docs/end.txt
index 98ca25bda..8f2c98ec8 100644
--- a/src/mailman/commands/docs/end.txt
+++ b/src/mailman/commands/docs/end.txt
@@ -7,8 +7,8 @@ processing email messages.
>>> command = config.commands['end']
>>> command.name
'end'
- >>> command.description
- u'Stop processing commands.'
+ >>> print command.description
+ Stop processing commands.
The 'end' command takes no arguments.
@@ -19,7 +19,7 @@ The command itself is fairly simple; it just stops command processing, and the
message isn't even looked at.
>>> from mailman.app.lifecycle import create_list
- >>> mlist = create_list(u'test@example.com')
+ >>> mlist = create_list('test@example.com')
>>> from mailman.email.message import Message
>>> print command.process(mlist, Message(), {}, (), None)
ContinueProcessing.no
@@ -27,10 +27,10 @@ message isn't even looked at.
The 'stop' command is a synonym for 'end'.
>>> command = config.commands['stop']
- >>> command.name
- 'stop'
- >>> command.description
- u'Stop processing commands.'
+ >>> print command.name
+ stop
+ >>> print command.description
+ Stop processing commands.
>>> command.argument_description
''
>>> print command.process(mlist, Message(), {}, (), None)
diff --git a/src/mailman/commands/docs/join.txt b/src/mailman/commands/docs/join.txt
index eaafddc7c..8e4922151 100644
--- a/src/mailman/commands/docs/join.txt
+++ b/src/mailman/commands/docs/join.txt
@@ -28,7 +28,7 @@ No address to join
>>> from mailman.email.message import Message
>>> from mailman.app.lifecycle import create_list
>>> from mailman.queue.command import Results
- >>> mlist = create_list(u'alpha@example.com')
+ >>> mlist = create_list('alpha@example.com')
When no address argument is given, the message's From address will be used.
If that's missing though, then an error is returned.
@@ -78,7 +78,7 @@ When the message has a From field, that address will be subscribed.
Anne is not yet a member because she must confirm her subscription request
first.
- >>> print config.db.user_manager.get_user(u'anne@example.com')
+ >>> print config.db.user_manager.get_user('anne@example.com')
None
Mailman has sent her the confirmation message.
@@ -121,11 +121,11 @@ list.
>>> token = str(qmsg['subject']).split()[1].strip()
>>> from mailman.interfaces.domain import IDomainManager
>>> from mailman.interfaces.registrar import IRegistrar
- >>> registrar = IRegistrar(IDomainManager(config)[u'example.com'])
+ >>> registrar = IRegistrar(IDomainManager(config)['example.com'])
>>> registrar.confirm(token)
True
- >>> user = config.db.user_manager.get_user(u'anne@example.com')
+ >>> user = config.db.user_manager.get_user('anne@example.com')
>>> print user.real_name
Anne Person
>>> list(user.addresses)
@@ -133,7 +133,7 @@ list.
Anne is also now a member of the mailing list.
- >>> mlist.members.get_member(u'anne@example.com')
+ >>> mlist.members.get_member('anne@example.com')
<Member: Anne Person <anne@example.com>
on alpha@example.com as MemberRole.member>
@@ -141,7 +141,7 @@ Anne is also now a member of the mailing list.
Joining a second list
---------------------
- >>> mlist_2 = create_list(u'baker@example.com')
+ >>> mlist_2 = create_list('baker@example.com')
>>> msg = message_from_string("""\
... From: Anne Person <anne@example.com>
...
@@ -151,12 +151,12 @@ Joining a second list
Anne of course, is still registered.
- >>> print config.db.user_manager.get_user(u'anne@example.com')
+ >>> print config.db.user_manager.get_user('anne@example.com')
<User "Anne Person" at ...>
But she is not a member of the mailing list.
- >>> print mlist_2.members.get_member(u'anne@example.com')
+ >>> print mlist_2.members.get_member('anne@example.com')
None
One Anne confirms this subscription, she becomes a member of the mailing list.
@@ -166,6 +166,6 @@ One Anne confirms this subscription, she becomes a member of the mailing list.
>>> registrar.confirm(token)
True
- >>> print mlist_2.members.get_member(u'anne@example.com')
+ >>> print mlist_2.members.get_member('anne@example.com')
<Member: Anne Person <anne@example.com>
on baker@example.com as MemberRole.member>
diff --git a/src/mailman/database/__init__.py b/src/mailman/database/__init__.py
index 8b7f584c2..a60a0d23c 100644
--- a/src/mailman/database/__init__.py
+++ b/src/mailman/database/__init__.py
@@ -122,7 +122,7 @@ class StockDatabase:
for statement in sql.split(';'):
store.execute(statement + ';')
# Validate schema version.
- v = store.find(Version, component=u'schema').one()
+ v = store.find(Version, component='schema').one()
if not v:
# Database has not yet been initialized
v = Version(component='schema',
diff --git a/src/mailman/docs/addresses.txt b/src/mailman/docs/addresses.txt
index 1621afa90..0c0be9505 100644
--- a/src/mailman/docs/addresses.txt
+++ b/src/mailman/docs/addresses.txt
@@ -21,7 +21,7 @@ no addresses.
Creating an unlinked email address is straightforward.
- >>> address_1 = usermgr.create_address(u'aperson@example.com')
+ >>> address_1 = usermgr.create_address('aperson@example.com')
>>> sorted(address.address for address in usermgr.addresses)
[u'aperson@example.com']
@@ -33,7 +33,7 @@ However, such addresses have no real name.
You can also create an email address object with a real name.
>>> address_2 = usermgr.create_address(
- ... u'bperson@example.com', u'Ben Person')
+ ... 'bperson@example.com', 'Ben Person')
>>> sorted(address.address for address in usermgr.addresses)
[u'aperson@example.com', u'bperson@example.com']
>>> sorted(address.real_name for address in usermgr.addresses)
@@ -49,22 +49,22 @@ the repr() carries more information.
You can assign real names to existing addresses.
- >>> address_1.real_name = u'Anne Person'
+ >>> address_1.real_name = 'Anne Person'
>>> sorted(address.real_name for address in usermgr.addresses)
[u'Anne Person', u'Ben Person']
These addresses are not linked to users, and can be seen by searching the user
manager for an associated user.
- >>> print usermgr.get_user(u'aperson@example.com')
+ >>> print usermgr.get_user('aperson@example.com')
None
- >>> print usermgr.get_user(u'bperson@example.com')
+ >>> print usermgr.get_user('bperson@example.com')
None
You can create email addresses that are linked to users by using a different
interface.
- >>> user_1 = usermgr.create_user(u'cperson@example.com', u'Claire Person')
+ >>> user_1 = usermgr.create_user('cperson@example.com', u'Claire Person')
>>> sorted(address.address for address in user_1.addresses)
[u'cperson@example.com']
>>> sorted(address.address for address in usermgr.addresses)
@@ -74,11 +74,11 @@ interface.
And now you can find the associated user.
- >>> print usermgr.get_user(u'aperson@example.com')
+ >>> print usermgr.get_user('aperson@example.com')
None
- >>> print usermgr.get_user(u'bperson@example.com')
+ >>> print usermgr.get_user('bperson@example.com')
None
- >>> usermgr.get_user(u'cperson@example.com')
+ >>> usermgr.get_user('cperson@example.com')
<User "Claire Person" at ...>
@@ -98,13 +98,13 @@ address from the user.
>>> sorted(address.address for address in user_1.addresses)
[u'cperson@example.com']
- >>> user_1.controls(u'cperson@example.com')
+ >>> user_1.controls('cperson@example.com')
True
>>> address_3 = list(user_1.addresses)[0]
>>> usermgr.delete_address(address_3)
>>> sorted(address.address for address in user_1.addresses)
[]
- >>> user_1.controls(u'cperson@example.com')
+ >>> user_1.controls('cperson@example.com')
False
>>> sorted(address.address for address in usermgr.addresses)
[u'bperson@example.com']
@@ -117,7 +117,7 @@ Addresses have two dates, the date the address was registered on and the date
the address was validated on. Neither date is set by default.
>>> address_4 = usermgr.create_address(
- ... u'dperson@example.com', u'Dan Person')
+ ... 'dperson@example.com', 'Dan Person')
>>> print address_4.registered_on
None
>>> print address_4.verified_on
@@ -148,8 +148,8 @@ Addresses get subscribed to mailing lists, not users. When the address is
subscribed, a role is specified.
>>> address_5 = usermgr.create_address(
- ... u'eperson@example.com', u'Elly Person')
- >>> mlist = create_list(u'_xtext@example.com')
+ ... 'eperson@example.com', 'Elly Person')
+ >>> mlist = create_list('_xtext@example.com')
>>> from mailman.interfaces.member import MemberRole
>>> address_5.subscribe(mlist, MemberRole.owner)
@@ -188,7 +188,7 @@ when sending the user a message, but it treats addresses that are different in
case equivalently in all other situations.
>>> address_6 = usermgr.create_address(
- ... u'FPERSON@example.com', u'Frank Person')
+ ... 'FPERSON@example.com', 'Frank Person')
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
@@ -203,23 +203,23 @@ details.
Both the case-insensitive version of the address and the original
case-preserved version are available on attributes of the IAddress object.
- >>> address_6.address
- u'fperson@example.com'
- >>> address_6.original_address
- u'FPERSON@example.com'
+ >>> print address_6.address
+ fperson@example.com
+ >>> print address_6.original_address
+ FPERSON@example.com
Because addresses are case-insensitive for all other purposes, you cannot
create an address that differs only in case.
- >>> usermgr.create_address(u'fperson@example.com')
+ >>> usermgr.create_address('fperson@example.com')
Traceback (most recent call last):
...
ExistingAddressError: FPERSON@example.com
- >>> usermgr.create_address(u'fperson@EXAMPLE.COM')
+ >>> usermgr.create_address('fperson@EXAMPLE.COM')
Traceback (most recent call last):
...
ExistingAddressError: FPERSON@example.com
- >>> usermgr.create_address(u'FPERSON@example.com')
+ >>> usermgr.create_address('FPERSON@example.com')
Traceback (most recent call last):
...
ExistingAddressError: FPERSON@example.com
@@ -227,7 +227,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.
- >>> usermgr.get_address(u'fperson@example.com').address
- u'fperson@example.com'
- >>> usermgr.get_address(u'FPERSON@example.com').address
- u'fperson@example.com'
+ >>> print usermgr.get_address('fperson@example.com').address
+ fperson@example.com
+ >>> print usermgr.get_address('FPERSON@example.com').address
+ fperson@example.com
diff --git a/src/mailman/docs/autorespond.txt b/src/mailman/docs/autorespond.txt
index 7aac90b1c..02a4e3acd 100644
--- a/src/mailman/docs/autorespond.txt
+++ b/src/mailman/docs/autorespond.txt
@@ -28,8 +28,7 @@ automatic response when messages are held for approval, or when it receives an
email command. You can find out how many responses for a particular address
have already been sent today.
- >>> address = config.db.user_manager.create_address(
- ... u'aperson@example.com')
+ >>> address = config.db.user_manager.create_address('aperson@example.com')
>>> from mailman.interfaces.autorespond import Response
>>> response_set.todays_count(address, Response.hold)
0
@@ -100,9 +99,7 @@ When another response is sent today, that becomes the last one sent.
If there's been no response sent to a particular address, None is returned.
- >>> address = config.db.user_manager.create_address(
- ... u'bperson@example.com')
-
+ >>> address = config.db.user_manager.create_address('bperson@example.com')
>>> response_set.todays_count(address, Response.command)
0
>>> print response_set.last_response(address, Response.command)
diff --git a/src/mailman/docs/bounces.txt b/src/mailman/docs/bounces.txt
index 9e8bcd23b..5408af2cc 100644
--- a/src/mailman/docs/bounces.txt
+++ b/src/mailman/docs/bounces.txt
@@ -13,8 +13,8 @@ Mailman can also bounce messages back to the original sender. This is
essentially equivalent to rejecting the message with notification. Mailing
lists can bounce a message with an optional error message.
- >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
- >>> mlist.preferred_language = u'en'
+ >>> mlist = config.db.list_manager.create('_xtest@example.com')
+ >>> mlist.preferred_language = 'en'
Any message can be bounced.
diff --git a/src/mailman/docs/chains.txt b/src/mailman/docs/chains.txt
index b6e75e6e1..186590a93 100644
--- a/src/mailman/docs/chains.txt
+++ b/src/mailman/docs/chains.txt
@@ -25,7 +25,7 @@ The Discard chain simply throws the message away.
Discard a message and stop processing.
>>> from mailman.app.lifecycle import create_list
- >>> mlist = create_list(u'_xtest@example.com')
+ >>> mlist = create_list('_xtest@example.com')
>>> msg = message_from_string("""\
... From: aperson@example.com
... To: _xtest@example.com
diff --git a/src/mailman/docs/domains.txt b/src/mailman/docs/domains.txt
index bd7ff5791..e333d9ad8 100644
--- a/src/mailman/docs/domains.txt
+++ b/src/mailman/docs/domains.txt
@@ -6,7 +6,7 @@ Domains
# that first.
>>> from mailman.interfaces.domain import IDomainManager
>>> manager = IDomainManager(config)
- >>> manager.remove(u'example.com')
+ >>> manager.remove('example.com')
<Domain example.com...>
Domains are how Mailman interacts with email host names and web host names.
@@ -25,7 +25,7 @@ Domains are how Mailman interacts with email host names and web host names.
Adding a domain requires some basic information, of which the email host name
is the only required piece. The other parts are inferred from that.
- >>> manager.add(u'example.org')
+ >>> manager.add('example.org')
<Domain example.org, base_url: http://example.org,
contact_address: postmaster@example.org>
>>> show_domains()
@@ -34,7 +34,7 @@ is the only required piece. The other parts are inferred from that.
We can remove domains too.
- >>> manager.remove(u'example.org')
+ >>> manager.remove('example.org')
<Domain example.org, base_url: http://example.org,
contact_address: postmaster@example.org>
>>> show_domains()
@@ -43,7 +43,7 @@ We can remove domains too.
Sometimes the email host name is different than the base url for hitting the
web interface for the domain.
- >>> manager.add(u'example.com', base_url=u'https://mail.example.com')
+ >>> manager.add('example.com', base_url='https://mail.example.com')
<Domain example.com, base_url: https://mail.example.com,
contact_address: postmaster@example.com>
>>> show_domains()
@@ -53,10 +53,10 @@ web interface for the domain.
Domains can have explicit descriptions and contact addresses.
>>> manager.add(
- ... u'example.net',
- ... base_url=u'http://lists.example.net',
- ... contact_address=u'postmaster@example.com',
- ... description=u'The example domain')
+ ... 'example.net',
+ ... base_url='http://lists.example.net',
+ ... contact_address='postmaster@example.com',
+ ... description='The example domain')
<Domain example.net, The example domain,
base_url: http://lists.example.net,
contact_address: postmaster@example.com>
@@ -75,12 +75,12 @@ In the global domain manager, domains are indexed by their email host name.
example.com
example.net
- >>> print manager[u'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[u'doesnotexist.com']
+ >>> print manager['doesnotexist.com']
Traceback (most recent call last):
...
KeyError: u'doesnotexist.com'
@@ -88,20 +88,20 @@ In the global domain manager, domains are indexed by their email host name.
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(u'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(u'doesnotexist.com')
+ >>> print manager.get('doesnotexist.com')
None
- >>> print manager.get(u'doesnotexist.com', u'blahdeblah')
+ >>> print manager.get('doesnotexist.com', 'blahdeblah')
blahdeblah
Non-existent domains cannot be removed.
- >>> manager.remove(u'doesnotexist.com')
+ >>> manager.remove('doesnotexist.com')
Traceback (most recent call last):
...
KeyError: u'doesnotexist.com'
@@ -112,11 +112,11 @@ Confirmation tokens
Confirmation tokens can be added to either the email confirmation address...
- >>> domain = manager[u'example.net']
- >>> print domain.confirm_address(u'xyz')
+ >>> domain = manager['example.net']
+ >>> print domain.confirm_address('xyz')
confirm-xyz@example.net
...or the confirmation url.
- >>> print domain.confirm_url(u'abc')
+ >>> print domain.confirm_url('abc')
http://lists.example.net/confirm/abc
diff --git a/src/mailman/docs/lifecycle.txt b/src/mailman/docs/lifecycle.txt
index c6c0c0671..8f45dc880 100644
--- a/src/mailman/docs/lifecycle.txt
+++ b/src/mailman/docs/lifecycle.txt
@@ -52,7 +52,7 @@ Start by registering a test style.
... priority = 10
... def apply(self, mailing_list):
... # Just does something very simple.
- ... mailing_list.msg_footer = u'test footer'
+ ... mailing_list.msg_footer = 'test footer'
... def match(self, mailing_list, styles):
... # Applies to any test list
... if 'test' in mailing_list.fqdn_listname:
@@ -63,11 +63,11 @@ Start by registering a test style.
Using the higher level interface for creating a list, applies all matching
list styles.
- >>> mlist_1 = create_list(u'test_1@example.com')
- >>> mlist_1.fqdn_listname
- u'test_1@example.com'
- >>> mlist_1.msg_footer
- u'test footer'
+ >>> mlist_1 = create_list('test_1@example.com')
+ >>> print mlist_1.fqdn_listname
+ test_1@example.com
+ >>> print mlist_1.msg_footer
+ test footer
Creating a list with owners
@@ -77,13 +77,13 @@ You can also specify a list of owner email addresses. If these addresses are
not yet known, they will be registered, and new users will be linked to them.
However the addresses are not verified.
- >>> owners = [u'aperson@example.com', u'bperson@example.com',
- ... u'cperson@example.com', u'dperson@example.com']
- >>> mlist_2 = create_list(u'test_2@example.com', owners)
- >>> mlist_2.fqdn_listname
- u'test_2@example.com'
- >>> mlist_2.msg_footer
- u'test footer'
+ >>> owners = ['aperson@example.com', 'bperson@example.com',
+ ... 'cperson@example.com', 'dperson@example.com']
+ >>> mlist_2 = create_list('test_2@example.com', owners)
+ >>> print mlist_2.fqdn_listname
+ test_2@example.com
+ >>> print mlist_2.msg_footer
+ test footer
>>> sorted(addr.address for addr in mlist_2.owners.addresses)
[u'aperson@example.com', u'bperson@example.com',
u'cperson@example.com', u'dperson@example.com']
@@ -103,16 +103,16 @@ If you create a mailing list with owner addresses that are already known to
the system, they won't be created again.
>>> usermgr = config.db.user_manager
- >>> user_a = usermgr.get_user(u'aperson@example.com')
- >>> user_b = usermgr.get_user(u'bperson@example.com')
- >>> user_c = usermgr.get_user(u'cperson@example.com')
- >>> user_d = usermgr.get_user(u'dperson@example.com')
- >>> user_a.real_name = u'Anne Person'
- >>> user_b.real_name = u'Bart Person'
- >>> user_c.real_name = u'Caty Person'
- >>> user_d.real_name = u'Dirk Person'
+ >>> user_a = usermgr.get_user('aperson@example.com')
+ >>> user_b = usermgr.get_user('bperson@example.com')
+ >>> user_c = usermgr.get_user('cperson@example.com')
+ >>> user_d = usermgr.get_user('dperson@example.com')
+ >>> user_a.real_name = 'Anne Person'
+ >>> user_b.real_name = 'Bart Person'
+ >>> user_c.real_name = 'Caty Person'
+ >>> user_d.real_name = 'Dirk Person'
- >>> mlist_3 = create_list(u'test_3@example.com', owners)
+ >>> mlist_3 = create_list('test_3@example.com', owners)
>>> sorted(user.real_name for user in mlist_3.owners.users)
[u'Anne Person', u'Bart Person', u'Caty Person', u'Dirk Person']
@@ -130,7 +130,7 @@ artifacts.
We should now be able to completely recreate the mailing list.
- >>> mlist_2a = create_list(u'test_2@example.com', owners)
+ >>> mlist_2a = create_list('test_2@example.com', owners)
>>> sorted(addr.address for addr in mlist_2a.owners.addresses)
[u'aperson@example.com', u'bperson@example.com',
u'cperson@example.com', u'dperson@example.com']
diff --git a/src/mailman/docs/listmanager.txt b/src/mailman/docs/listmanager.txt
index c082dc001..c432a8613 100644
--- a/src/mailman/docs/listmanager.txt
+++ b/src/mailman/docs/listmanager.txt
@@ -19,7 +19,7 @@ Creating a mailing list
Creating the list returns the newly created IMailList object.
>>> from mailman.interfaces.mailinglist import IMailingList
- >>> mlist = listmgr.create(u'_xtest@example.com')
+ >>> mlist = listmgr.create('_xtest@example.com')
>>> IMailingList.providedBy(mlist)
True
@@ -27,17 +27,17 @@ All lists with identities have a short name, a host name, and a fully
qualified listname. This latter is what uniquely distinguishes the mailing
list to the system.
- >>> mlist.list_name
- u'_xtest'
- >>> mlist.host_name
- u'example.com'
- >>> mlist.fqdn_listname
- u'_xtest@example.com'
+ >>> print mlist.list_name
+ _xtest
+ >>> print mlist.host_name
+ example.com
+ >>> print mlist.fqdn_listname
+ _xtest@example.com
If you try to create a mailing list with the same name as an existing list,
you will get an exception.
- >>> mlist_dup = listmgr.create(u'_xtest@example.com')
+ >>> mlist_dup = listmgr.create('_xtest@example.com')
Traceback (most recent call last):
...
ListAlreadyExistsError: _xtest@example.com
@@ -54,9 +54,9 @@ Use the list manager to delete a mailing list.
After deleting the list, you can create it again.
- >>> mlist = listmgr.create(u'_xtest@example.com')
- >>> mlist.fqdn_listname
- u'_xtest@example.com'
+ >>> mlist = listmgr.create('_xtest@example.com')
+ >>> print mlist.fqdn_listname
+ _xtest@example.com
Retrieving a mailing list
@@ -65,13 +65,13 @@ Retrieving a mailing list
When a mailing list exists, you can ask the list manager for it and you will
always get the same object back.
- >>> mlist_2 = listmgr.get(u'_xtest@example.com')
+ >>> mlist_2 = listmgr.get('_xtest@example.com')
>>> mlist_2 is mlist
True
If you try to get a list that doesn't existing yet, you get None.
- >>> print listmgr.get(u'_xtest_2@example.com')
+ >>> print listmgr.get('_xtest_2@example.com')
None
@@ -81,8 +81,8 @@ Iterating over all mailing lists
Once you've created a bunch of mailing lists, you can use the list manager to
iterate over either the list objects, or the list names.
- >>> mlist_3 = listmgr.create(u'_xtest_3@example.com')
- >>> mlist_4 = listmgr.create(u'_xtest_4@example.com')
+ >>> mlist_3 = listmgr.create('_xtest_3@example.com')
+ >>> mlist_4 = listmgr.create('_xtest_4@example.com')
>>> sorted(listmgr.names)
[u'_xtest@example.com', u'_xtest_3@example.com', u'_xtest_4@example.com']
>>> sorted(m.fqdn_listname for m in listmgr.mailing_lists)
diff --git a/src/mailman/docs/membership.txt b/src/mailman/docs/membership.txt
index fce7a3f8a..26cdd2aea 100644
--- a/src/mailman/docs/membership.txt
+++ b/src/mailman/docs/membership.txt
@@ -14,7 +14,7 @@ store mailing list data in a different database than user data.
When we create a mailing list, it starts out with no members...
- >>> mlist = create_list(u'_xtest@example.com')
+ >>> mlist = create_list('_xtest@example.com')
>>> mlist
<mailing list "_xtest@example.com" at ...>
>>> sorted(member.address.address for member in mlist.members.members)
@@ -63,9 +63,9 @@ assigning roles to users. First we have to create the user, because there are
no users in the user database yet.
>>> usermgr = config.db.user_manager
- >>> user_1 = usermgr.create_user(u'aperson@example.com', u'Anne Person')
- >>> user_1.real_name
- u'Anne Person'
+ >>> user_1 = usermgr.create_user('aperson@example.com', 'Anne Person')
+ >>> print user_1.real_name
+ Anne Person
>>> sorted(address.address for address in user_1.addresses)
[u'aperson@example.com']
@@ -74,8 +74,8 @@ her.
>>> from mailman.interfaces.member import MemberRole
>>> address_1 = list(user_1.addresses)[0]
- >>> address_1.address
- u'aperson@example.com'
+ >>> print address_1.address
+ aperson@example.com
>>> address_1.subscribe(mlist, MemberRole.owner)
<Member: Anne Person <aperson@example.com> on
_xtest@example.com as MemberRole.owner>
@@ -99,12 +99,12 @@ her a moderator. Nor does it make her a member of the list.
We can add Ben as a moderator of the list, by creating a different member role
for him.
- >>> user_2 = usermgr.create_user(u'bperson@example.com', u'Ben Person')
- >>> user_2.real_name
- u'Ben Person'
+ >>> user_2 = usermgr.create_user('bperson@example.com', 'Ben Person')
+ >>> print user_2.real_name
+ Ben Person
>>> address_2 = list(user_2.addresses)[0]
- >>> address_2.address
- u'bperson@example.com'
+ >>> print address_2.address
+ bperson@example.com
>>> address_2.subscribe(mlist, MemberRole.moderator)
<Member: Ben Person <bperson@example.com>
on _xtest@example.com as MemberRole.moderator>
@@ -136,12 +136,12 @@ delivery. Without a preference, Mailman will fall back first to the address's
preference, then the user's preference, then the list's preference. Start
without any member preference to see the system defaults.
- >>> user_3 = usermgr.create_user(u'cperson@example.com', u'Claire Person')
- >>> user_3.real_name
- u'Claire Person'
+ >>> user_3 = usermgr.create_user('cperson@example.com', 'Claire Person')
+ >>> print user_3.real_name
+ Claire Person
>>> address_3 = list(user_3.addresses)[0]
- >>> address_3.address
- u'cperson@example.com'
+ >>> print address_3.address
+ cperson@example.com
>>> address_3.subscribe(mlist, MemberRole.member)
<Member: Claire Person <cperson@example.com>
on _xtest@example.com as MemberRole.member>
@@ -180,24 +180,24 @@ Finding members
You can find the IMember object that is a member of a roster for a given text
email address by using an IRoster's .get_member() method.
- >>> mlist.owners.get_member(u'aperson@example.com')
+ >>> mlist.owners.get_member('aperson@example.com')
<Member: Anne Person <aperson@example.com> on
_xtest@example.com as MemberRole.owner>
- >>> mlist.administrators.get_member(u'aperson@example.com')
+ >>> mlist.administrators.get_member('aperson@example.com')
<Member: Anne Person <aperson@example.com> on
_xtest@example.com as MemberRole.owner>
- >>> mlist.members.get_member(u'aperson@example.com')
+ >>> mlist.members.get_member('aperson@example.com')
<Member: Anne Person <aperson@example.com> on
_xtest@example.com as MemberRole.member>
However, if the address is not subscribed with the appropriate role, then None
is returned.
- >>> print mlist.administrators.get_member(u'zperson@example.com')
+ >>> print mlist.administrators.get_member('zperson@example.com')
None
- >>> print mlist.moderators.get_member(u'aperson@example.com')
+ >>> print mlist.moderators.get_member('aperson@example.com')
None
- >>> print mlist.members.get_member(u'zperson@example.com')
+ >>> print mlist.members.get_member('zperson@example.com')
None
diff --git a/src/mailman/docs/message.txt b/src/mailman/docs/message.txt
index 704842fe4..84b0eaf3e 100644
--- a/src/mailman/docs/message.txt
+++ b/src/mailman/docs/message.txt
@@ -12,7 +12,7 @@ When Mailman needs to send a message to a user, it creates a UserNotification
instance, and then calls the .send() method on this object. This method
requires a mailing list instance.
- >>> mlist = create_list(u'_xtest@example.com')
+ >>> mlist = create_list('_xtest@example.com')
The UserNotification constructor takes the recipient address, the sender
address, an optional subject, optional body text, and optional language.
diff --git a/src/mailman/docs/messagestore.txt b/src/mailman/docs/messagestore.txt
index 6e04568c5..8c83d84c0 100644
--- a/src/mailman/docs/messagestore.txt
+++ b/src/mailman/docs/messagestore.txt
@@ -43,9 +43,9 @@ 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 store.get_message_by_id(u'nothing')
+ >>> print store.get_message_by_id('nothing')
None
- >>> print store.get_message_by_hash(u'nothing')
+ >>> print store.get_message_by_hash('nothing')
None
Given an existing Message-ID, the message can be found.
@@ -96,7 +96,7 @@ You delete a message from the storage service by providing the Message-ID for
the message you want to delete. If you try to delete a Message-ID that isn't
in the store, you get an exception.
- >>> store.delete_message(u'nothing')
+ >>> store.delete_message('nothing')
Traceback (most recent call last):
...
LookupError: nothing
diff --git a/src/mailman/docs/mlist-addresses.txt b/src/mailman/docs/mlist-addresses.txt
index 75ec3df37..48d25a8f3 100644
--- a/src/mailman/docs/mlist-addresses.txt
+++ b/src/mailman/docs/mlist-addresses.txt
@@ -4,54 +4,54 @@ Mailing list addresses
Every mailing list has a number of addresses which are publicly available.
These are defined in the IMailingListAddresses interface.
- >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
+ >>> mlist = config.db.list_manager.create('_xtest@example.com')
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.
- >>> mlist.fqdn_listname
- u'_xtest@example.com'
- >>> mlist.posting_address
- u'_xtest@example.com'
+ >>> print mlist.fqdn_listname
+ _xtest@example.com
+ >>> print mlist.posting_address
+ _xtest@example.com
Messages to the mailing list's 'no reply' address always get discarded without
prejudice.
- >>> mlist.no_reply_address
- u'noreply@example.com'
+ >>> print mlist.no_reply_address
+ noreply@example.com
The mailing list's owner address reaches the human moderators.
- >>> mlist.owner_address
- u'_xtest-owner@example.com'
+ >>> print mlist.owner_address
+ _xtest-owner@example.com
The request address goes to the list's email command robot.
- >>> mlist.request_address
- u'_xtest-request@example.com'
+ >>> print mlist.request_address
+ _xtest-request@example.com
The bounces address accepts and processes all potential bounces.
- >>> mlist.bounces_address
- u'_xtest-bounces@example.com'
+ >>> 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.
- >>> mlist.join_address
- u'_xtest-join@example.com'
- >>> mlist.subscribe_address
- u'_xtest-subscribe@example.com'
+ >>> print mlist.join_address
+ _xtest-join@example.com
+ >>> 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.
- >>> mlist.leave_address
- u'_xtest-leave@example.com'
- >>> mlist.unsubscribe_address
- u'_xtest-unsubscribe@example.com'
+ >>> print mlist.leave_address
+ _xtest-leave@example.com
+ >>> print mlist.unsubscribe_address
+ _xtest-unsubscribe@example.com
Email confirmations
@@ -62,15 +62,15 @@ to be confirmed. It requires that a cookie be provided, which will be
included in the local part of the email address. The exact format of this is
dependent on the VERP_CONFIRM_FORMAT configuration variable.
- >>> mlist.confirm_address('cookie')
- u'_xtest-confirm+cookie@example.com'
- >>> mlist.confirm_address('wookie')
- u'_xtest-confirm+wookie@example.com'
+ >>> print mlist.confirm_address('cookie')
+ _xtest-confirm+cookie@example.com
+ >>> print mlist.confirm_address('wookie')
+ _xtest-confirm+wookie@example.com
>>> config.push('test config', """
... [mta]
... verp_confirm_format: $address---$cookie
... """)
- >>> mlist.confirm_address('cookie')
- u'_xtest-confirm---cookie@example.com'
+ >>> print mlist.confirm_address('cookie')
+ _xtest-confirm---cookie@example.com
>>> config.pop('test config')
diff --git a/src/mailman/tests/test_documentation.py b/src/mailman/tests/test_documentation.py
index 06cd3f8b2..48b71d72c 100644
--- a/src/mailman/tests/test_documentation.py
+++ b/src/mailman/tests/test_documentation.py
@@ -132,6 +132,10 @@ def dump_json(url):
def setup(testobj):
"""Test setup."""
+ # Make sure future statements in our doctests are the same as everywhere
+ # else.
+ testobj.globs['absolute_import'] = absolute_import
+ testobj.globs['unicode_literals'] = unicode_literals
# In general, I don't like adding convenience functions, since I think
# doctests should do the imports themselves. It makes for better
# documentation that way. However, a few are really useful, or help to