summaryrefslogtreecommitdiff
path: root/src/mailman/docs
diff options
context:
space:
mode:
authorBarry Warsaw2009-07-18 22:31:45 -0400
committerBarry Warsaw2009-07-18 22:31:45 -0400
commitd9ad19e86ff658a74870fb488cd74e5002b63bc3 (patch)
tree29a7e53c290a95d6280772d6aa52a8b160649596 /src/mailman/docs
parent422a6757e6aafbd12c220aa8dfdc33f8c377718c (diff)
downloadmailman-d9ad19e86ff658a74870fb488cd74e5002b63bc3.tar.gz
mailman-d9ad19e86ff658a74870fb488cd74e5002b63bc3.tar.zst
mailman-d9ad19e86ff658a74870fb488cd74e5002b63bc3.zip
De-u-literal-ify our doctests.
Diffstat (limited to 'src/mailman/docs')
-rw-r--r--src/mailman/docs/chains.txt11
-rw-r--r--src/mailman/docs/languages.txt4
-rw-r--r--src/mailman/docs/lifecycle.txt2
-rw-r--r--src/mailman/docs/pending.txt2
-rw-r--r--src/mailman/docs/pipelines.txt2
-rw-r--r--src/mailman/docs/registration.txt64
-rw-r--r--src/mailman/docs/requests.txt68
-rw-r--r--src/mailman/docs/styles.txt37
-rw-r--r--src/mailman/docs/usermanager.txt21
-rw-r--r--src/mailman/docs/users.txt56
10 files changed, 136 insertions, 131 deletions
diff --git a/src/mailman/docs/chains.txt b/src/mailman/docs/chains.txt
index 186590a93..3fee28e7d 100644
--- a/src/mailman/docs/chains.txt
+++ b/src/mailman/docs/chains.txt
@@ -1,3 +1,4 @@
+======
Chains
======
@@ -10,7 +11,7 @@ processing of messages.
The Discard chain
------------------
+=================
The Discard chain simply throws the message away.
@@ -50,7 +51,7 @@ The Discard chain simply throws the message away.
The Reject chain
-----------------
+================
The Reject chain bounces the message back to the original sender, and logs
this action.
@@ -95,7 +96,7 @@ The bounce message is now sitting in the Virgin queue.
The Hold Chain
---------------
+==============
The Hold chain places the message into the admin request database and
depending on the list's settings, sends a notification to both the original
@@ -248,7 +249,7 @@ The message itself is held in the message store.
The Accept chain
-----------------
+================
The Accept chain sends the message on the 'prep' queue, where it will be
processed and sent on to the list membership.
@@ -282,7 +283,7 @@ processed and sent on to the list membership.
Run-time chains
----------------
+===============
We can also define chains at run time, and these chains can be mutated.
Run-time chains are made up of links where each link associates both a rule
diff --git a/src/mailman/docs/languages.txt b/src/mailman/docs/languages.txt
index 87c68f034..77b51cbeb 100644
--- a/src/mailman/docs/languages.txt
+++ b/src/mailman/docs/languages.txt
@@ -49,7 +49,7 @@ You can iterate over all the known language codes.
>>> mgr.add('pl', 'iso-8859-2', 'Polish')
>>> sorted(mgr.codes)
- ['en', 'it', 'pl']
+ [u'en', u'it', u'pl']
You can iterate over all the known languages.
@@ -76,7 +76,7 @@ You can get a particular language by its code.
>>> print mgr['xx'].code
Traceback (most recent call last):
...
- KeyError: 'xx'
+ KeyError: u'xx'
>>> print mgr.get('it').description
Italian
>>> print mgr.get('xx')
diff --git a/src/mailman/docs/lifecycle.txt b/src/mailman/docs/lifecycle.txt
index 8f45dc880..e6dcc7c33 100644
--- a/src/mailman/docs/lifecycle.txt
+++ b/src/mailman/docs/lifecycle.txt
@@ -28,7 +28,7 @@ bogus posting address, you get an exception.
>>> create_list('not a valid address')
Traceback (most recent call last):
...
- InvalidEmailAddress: 'not a valid address'
+ InvalidEmailAddress: u'not a valid address'
If the posting address is valid, but the domain has not been registered with
Mailman yet, you get an exception.
diff --git a/src/mailman/docs/pending.txt b/src/mailman/docs/pending.txt
index abfba4885..5d7706bf6 100644
--- a/src/mailman/docs/pending.txt
+++ b/src/mailman/docs/pending.txt
@@ -38,7 +38,7 @@ basically means returning the IPendable structure (as a dict) from the
database that matches the token. If the token isn't in the database, None is
returned.
- >>> pendable = pendingdb.confirm('missing')
+ >>> pendable = pendingdb.confirm(bytes('missing'))
>>> print pendable
None
>>> pendable = pendingdb.confirm(token)
diff --git a/src/mailman/docs/pipelines.txt b/src/mailman/docs/pipelines.txt
index 36bf2dd23..5ad6ba243 100644
--- a/src/mailman/docs/pipelines.txt
+++ b/src/mailman/docs/pipelines.txt
@@ -10,7 +10,7 @@ rules and chains, there is no way to stop a pipeline from processing the
message once it's started.
>>> from mailman.app.lifecycle import create_list
- >>> mlist = create_list(u'xtest@example.com')
+ >>> mlist = create_list('xtest@example.com')
>>> print mlist.pipeline
built-in
>>> from mailman.core.pipelines import process
diff --git a/src/mailman/docs/registration.txt b/src/mailman/docs/registration.txt
index 519b81ba8..ff6466f82 100644
--- a/src/mailman/docs/registration.txt
+++ b/src/mailman/docs/registration.txt
@@ -17,7 +17,7 @@ stuff.
>>> from mailman.interfaces.domain import IDomainManager
>>> manager = IDomainManager(config)
- >>> domain = manager[u'example.com']
+ >>> domain = manager['example.com']
Get a registrar by adapting a domain.
@@ -51,27 +51,27 @@ Some amount of sanity checks are performed on the email address, although
honestly, not as much as probably should be done. Still, some patently bad
addresses are rejected outright.
- >>> registrar.register(u'')
+ >>> registrar.register('')
Traceback (most recent call last):
...
InvalidEmailAddress: u''
- >>> registrar.register(u'some name@example.com')
+ >>> registrar.register('some name@example.com')
Traceback (most recent call last):
...
InvalidEmailAddress: u'some name@example.com'
- >>> registrar.register(u'<script>@example.com')
+ >>> registrar.register('<script>@example.com')
Traceback (most recent call last):
...
InvalidEmailAddress: u'<script>@example.com'
- >>> registrar.register(u'\xa0@example.com')
+ >>> registrar.register('\xa0@example.com')
Traceback (most recent call last):
...
InvalidEmailAddress: u'\xa0@example.com'
- >>> registrar.register(u'noatsign')
+ >>> registrar.register('noatsign')
Traceback (most recent call last):
...
InvalidEmailAddress: u'noatsign'
- >>> registrar.register(u'nodom@ain')
+ >>> registrar.register('nodom@ain')
Traceback (most recent call last):
...
InvalidEmailAddress: u'nodom@ain'
@@ -85,16 +85,16 @@ is complete. No IUser or IAddress is created at registration time, but a
record is added to the pending database, and the token for that record is
returned.
- >>> token = registrar.register(u'aperson@example.com', u'Anne Person')
+ >>> token = registrar.register('aperson@example.com', 'Anne Person')
>>> check_token(token)
ok
There should be no records in the user manager for this address yet.
>>> usermgr = config.db.user_manager
- >>> print usermgr.get_user(u'aperson@example.com')
+ >>> print usermgr.get_user('aperson@example.com')
None
- >>> print usermgr.get_address(u'aperson@example.com')
+ >>> print usermgr.get_address('aperson@example.com')
None
But this address is waiting for confirmation.
@@ -185,10 +185,10 @@ extracts the token and uses that to confirm the pending registration.
Now, there is an IAddress in the database matching the address, as well as an
IUser linked to this address. The IAddress is verified.
- >>> found_address = usermgr.get_address(u'aperson@example.com')
+ >>> found_address = usermgr.get_address('aperson@example.com')
>>> found_address
<Address: Anne Person <aperson@example.com> [verified] at ...>
- >>> found_user = usermgr.get_user(u'aperson@example.com')
+ >>> found_user = usermgr.get_user('aperson@example.com')
>>> found_user
<User "Anne Person" at ...>
>>> found_user.controls(found_address.address)
@@ -204,7 +204,7 @@ Non-standard registrations
If you try to confirm a registration token twice, of course only the first one
will work. The second one is ignored.
- >>> token = registrar.register(u'bperson@example.com')
+ >>> token = registrar.register('bperson@example.com')
>>> check_token(token)
ok
>>> filebase = switchboard.files[0]
@@ -222,25 +222,25 @@ If an address is in the system, but that address is not linked to a user yet
and the address is not yet validated, then no user is created until the
confirmation step is completed.
- >>> usermgr.create_address(u'cperson@example.com')
+ >>> usermgr.create_address('cperson@example.com')
<Address: cperson@example.com [not verified] at ...>
- >>> token = registrar.register(u'cperson@example.com', u'Claire Person')
- >>> print usermgr.get_user(u'cperson@example.com')
+ >>> token = registrar.register('cperson@example.com', 'Claire Person')
+ >>> print usermgr.get_user('cperson@example.com')
None
>>> filebase = switchboard.files[0]
>>> qmsg, qdata = switchboard.dequeue(filebase)
>>> switchboard.finish(filebase)
>>> registrar.confirm(token)
True
- >>> usermgr.get_user(u'cperson@example.com')
+ >>> usermgr.get_user('cperson@example.com')
<User "Claire Person" at ...>
- >>> usermgr.get_address(u'cperson@example.com')
+ >>> usermgr.get_address('cperson@example.com')
<Address: cperson@example.com [verified] at ...>
Even if the address being registered has already been verified, the
registration sends a confirmation.
- >>> token = registrar.register(u'cperson@example.com')
+ >>> token = registrar.register('cperson@example.com')
>>> token is not None
True
@@ -251,15 +251,15 @@ Discarding
A confirmation token can also be discarded, say if the user changes his or her
mind about registering. When discarded, no IAddress or IUser is created.
- >>> token = registrar.register(u'eperson@example.com', u'Elly Person')
+ >>> token = registrar.register('eperson@example.com', 'Elly Person')
>>> check_token(token)
ok
>>> registrar.discard(token)
>>> print pendingdb.confirm(token)
None
- >>> print usermgr.get_address(u'eperson@example.com')
+ >>> print usermgr.get_address('eperson@example.com')
None
- >>> print usermgr.get_user(u'eperson@example.com')
+ >>> print usermgr.get_user('eperson@example.com')
None
@@ -270,24 +270,24 @@ When a new address for an existing user is registered, there isn't too much
different except that the new address will still need to be verified before it
can be used.
- >>> dperson = usermgr.create_user(u'dperson@example.com', u'Dave Person')
+ >>> dperson = usermgr.create_user('dperson@example.com', 'Dave Person')
>>> dperson
<User "Dave Person" at ...>
- >>> address = usermgr.get_address(u'dperson@example.com')
+ >>> address = usermgr.get_address('dperson@example.com')
>>> address.verified_on = datetime.now()
>>> from operator import attrgetter
>>> sorted((addr for addr in dperson.addresses), key=attrgetter('address'))
[<Address: Dave Person <dperson@example.com> [verified] at ...>]
- >>> dperson.register(u'david.person@example.com', u'David Person')
+ >>> dperson.register('david.person@example.com', 'David Person')
<Address: David Person <david.person@example.com> [not verified] at ...>
- >>> token = registrar.register(u'david.person@example.com')
+ >>> token = registrar.register('david.person@example.com')
>>> filebase = switchboard.files[0]
>>> qmsg, qdata = switchboard.dequeue(filebase)
>>> switchboard.finish(filebase)
>>> registrar.confirm(token)
True
- >>> user = usermgr.get_user(u'david.person@example.com')
+ >>> user = usermgr.get_user('david.person@example.com')
>>> user is dperson
True
>>> user
@@ -303,7 +303,7 @@ Corner cases
If you try to confirm a token that doesn't exist in the pending database, the
confirm method will just return None.
- >>> registrar.confirm('no token')
+ >>> registrar.confirm(bytes('no token'))
False
Likewise, if you try to confirm, through the IUserRegistrar interface, a token
@@ -329,19 +329,19 @@ Registration and subscription
Fred registers with Mailman at the same time that he subscribes to a mailing
list.
- >>> mlist = create_list(u'alpha@example.com')
+ >>> mlist = create_list('alpha@example.com')
>>> token = registrar.register(
- ... u'fred.person@example.com', 'Fred Person', mlist)
+ ... 'fred.person@example.com', 'Fred Person', mlist)
Before confirmation, Fred is not a member of the mailing list.
- >>> print mlist.members.get_member(u'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(u'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/docs/requests.txt b/src/mailman/docs/requests.txt
index c49f09895..4a04017aa 100644
--- a/src/mailman/docs/requests.txt
+++ b/src/mailman/docs/requests.txt
@@ -39,7 +39,7 @@ mailing list you need to get its requests object.
>>> from zope.interface.verify import verifyObject
>>> verifyObject(IRequests, config.db.requests)
True
- >>> mlist = create_list(u'test@example.com')
+ >>> mlist = create_list('test@example.com')
>>> requests = config.db.requests.get_list_requests(mlist)
>>> verifyObject(IListRequests, requests)
True
@@ -63,10 +63,10 @@ of associated data. The request database assigns no semantics to the held
data, except for the request type. Here we hold some simple bits of data.
>>> from mailman.interfaces.requests import RequestType
- >>> id_1 = requests.hold_request(RequestType.held_message, u'hold_1')
- >>> id_2 = requests.hold_request(RequestType.subscription, u'hold_2')
- >>> id_3 = requests.hold_request(RequestType.unsubscription, u'hold_3')
- >>> id_4 = requests.hold_request(RequestType.held_message, u'hold_4')
+ >>> id_1 = requests.hold_request(RequestType.held_message, 'hold_1')
+ >>> id_2 = requests.hold_request(RequestType.subscription, 'hold_2')
+ >>> id_3 = requests.hold_request(RequestType.unsubscription, 'hold_3')
+ >>> id_4 = requests.hold_request(RequestType.held_message, 'hold_4')
>>> id_1, id_2, id_3, id_4
(1, 2, 3, 4)
@@ -96,7 +96,7 @@ If we try to hold a request with a bogus type, we get an exception.
We can hold requests with additional data.
>>> data = dict(foo='yes', bar='no')
- >>> id_5 = requests.hold_request(RequestType.held_message, u'hold_5', data)
+ >>> id_5 = requests.hold_request(RequestType.held_message, 'hold_5', data)
>>> id_5
5
>>> requests.count
@@ -215,9 +215,9 @@ Holding messages
For this section, we need a mailing list and at least one message.
- >>> mlist = create_list(u'alist@example.com')
- >>> mlist.preferred_language = u'en'
- >>> mlist.real_name = u'A Test List'
+ >>> mlist = create_list('alist@example.com')
+ >>> mlist.preferred_language = 'en'
+ >>> mlist.real_name = 'A Test List'
>>> msg = message_from_string("""\
... From: aperson@example.org
... To: alist@example.com
@@ -243,7 +243,7 @@ We can also hold a message with some additional metadata.
>>> msgdata = dict(sender='aperson@example.com',
... approved=True,
... received_time=123.45)
- >>> id_2 = moderator.hold_message(mlist, msg, msgdata, u'Feeling ornery')
+ >>> id_2 = moderator.hold_message(mlist, msg, msgdata, 'Feeling ornery')
>>> requests.get_request(id_2) is not None
True
@@ -346,7 +346,7 @@ is deleted.
... """)
>>> id_4 = moderator.hold_message(mlist, msg, {}, 'Needs approval')
>>> moderator.handle_message(mlist, id_4, Action.discard)
- >>> print config.db.message_store.get_message_by_id(u'<12345>')
+ >>> print config.db.message_store.get_message_by_id('<12345>')
None
But if we ask to preserve the message when we discard it, it will be held in
@@ -354,7 +354,7 @@ the message store after disposition.
>>> id_4 = moderator.hold_message(mlist, msg, {}, 'Needs approval')
>>> moderator.handle_message(mlist, id_4, Action.discard, preserve=True)
- >>> stored_msg = config.db.message_store.get_message_by_id(u'<12345>')
+ >>> stored_msg = config.db.message_store.get_message_by_id('<12345>')
>>> print stored_msg.as_string()
From: aperson@example.org
To: alist@example.com
@@ -372,10 +372,10 @@ moderators.
# Set a new Message-ID from the previous hold so we don't try to store
# collisions in the message storage.
>>> del msg['message-id']
- >>> msg['Message-ID'] = u'<abcde>'
+ >>> msg['Message-ID'] = '<abcde>'
>>> id_4 = moderator.hold_message(mlist, msg, {}, 'Needs approval')
>>> moderator.handle_message(mlist, id_4, Action.discard,
- ... forward=[u'zperson@example.com'])
+ ... forward=['zperson@example.com'])
>>> qmsg, qdata = dequeue()
>>> print qmsg.as_string()
Subject: Forward of moderated message
@@ -416,8 +416,8 @@ choosing and their preferred language.
>>> from mailman.interfaces.member import DeliveryMode
>>> mlist.admin_immed_notify = False
>>> id_3 = moderator.hold_subscription(mlist,
- ... u'bperson@example.org', u'Ben Person',
- ... u'{NONE}abcxyz', DeliveryMode.regular, u'en')
+ ... 'bperson@example.org', 'Ben Person',
+ ... '{NONE}abcxyz', DeliveryMode.regular, 'en')
>>> requests.get_request(id_3) is not None
True
@@ -436,8 +436,8 @@ queue when the message is held.
>>> # XXX This will almost certainly change once we've worked out the web
>>> # space layout for mailing lists now.
>>> id_4 = moderator.hold_subscription(mlist,
- ... u'cperson@example.org', u'Claire Person',
- ... u'{NONE}zyxcba', DeliveryMode.regular, u'en')
+ ... 'cperson@example.org', 'Claire Person',
+ ... '{NONE}zyxcba', DeliveryMode.regular, 'en')
>>> requests.get_request(id_4) is not None
True
>>> qmsg, qdata = dequeue()
@@ -533,8 +533,8 @@ mailing list.
>>> mlist.send_welcome_msg = True
>>> id_4 = moderator.hold_subscription(mlist,
- ... u'fperson@example.org', u'Frank Person',
- ... u'{NONE}abcxyz', DeliveryMode.regular, u'en')
+ ... 'fperson@example.org', 'Frank Person',
+ ... '{NONE}abcxyz', DeliveryMode.regular, 'en')
A message will be sent to the moderators telling them about the held
subscription and the fact that they may need to approve it.
@@ -673,7 +673,7 @@ The admin message is sent to the moderators.
Frank Person is now a member of the mailing list.
- >>> member = mlist.members.get_member(u'fperson@example.org')
+ >>> member = mlist.members.get_member('fperson@example.org')
>>> member
<Member: Frank Person <fperson@example.org>
on alist@example.com as MemberRole.member>
@@ -682,10 +682,10 @@ Frank Person is now a member of the mailing list.
>>> print member.delivery_mode
DeliveryMode.regular
>>> user = config.db.user_manager.get_user(member.address.address)
- >>> user.real_name
- u'Frank Person'
- >>> user.password
- u'{NONE}abcxyz'
+ >>> print user.real_name
+ Frank Person
+ >>> print user.password
+ {NONE}abcxyz
Holding unsubscription requests
@@ -697,21 +697,21 @@ unsubscription holds can send the list's moderators an immediate notification.
>>> mlist.admin_immed_notify = False
>>> from mailman.interfaces.member import MemberRole
- >>> user_1 = config.db.user_manager.create_user(u'gperson@example.com')
+ >>> user_1 = config.db.user_manager.create_user('gperson@example.com')
>>> address_1 = list(user_1.addresses)[0]
>>> address_1.subscribe(mlist, MemberRole.member)
<Member: gperson@example.com on alist@example.com as MemberRole.member>
- >>> user_2 = config.db.user_manager.create_user(u'hperson@example.com')
+ >>> user_2 = config.db.user_manager.create_user('hperson@example.com')
>>> address_2 = list(user_2.addresses)[0]
>>> address_2.subscribe(mlist, MemberRole.member)
<Member: hperson@example.com on alist@example.com as MemberRole.member>
- >>> id_5 = moderator.hold_unsubscription(mlist, u'gperson@example.com')
+ >>> id_5 = moderator.hold_unsubscription(mlist, 'gperson@example.com')
>>> requests.get_request(id_5) is not None
True
>>> virginq.files
[]
>>> mlist.admin_immed_notify = True
- >>> id_6 = moderator.hold_unsubscription(mlist, u'hperson@example.com')
+ >>> id_6 = moderator.hold_unsubscription(mlist, 'hperson@example.com')
>>> qmsg, qdata = dequeue()
>>> print qmsg.as_string()
MIME-Version: 1.0
@@ -758,7 +758,7 @@ subscribed.
>>> moderator.handle_unsubscription(mlist, id_5, Action.discard)
>>> print requests.get_request(id_5)
None
- >>> mlist.members.get_member(u'gperson@example.com')
+ >>> mlist.members.get_member('gperson@example.com')
<Member: gperson@example.com on alist@example.com as MemberRole.member>
The request can be rejected, in which case a message is sent to the member,
@@ -802,18 +802,18 @@ and the person remains a member of the mailing list.
reduced_list_headers: True
version : 3
- >>> mlist.members.get_member(u'hperson@example.com')
+ >>> mlist.members.get_member('hperson@example.com')
<Member: hperson@example.com on alist@example.com as MemberRole.member>
The unsubscription request can also be accepted. This removes the member from
the mailing list.
>>> mlist.send_goodbye_msg = True
- >>> mlist.goodbye_msg = u'So long!'
+ >>> mlist.goodbye_msg = 'So long!'
>>> mlist.admin_immed_notify = False
- >>> id_7 = moderator.hold_unsubscription(mlist, u'gperson@example.com')
+ >>> id_7 = moderator.hold_unsubscription(mlist, 'gperson@example.com')
>>> moderator.handle_unsubscription(mlist, id_7, Action.accept)
- >>> print mlist.members.get_member(u'gperson@example.com')
+ >>> print mlist.members.get_member('gperson@example.com')
None
There are now two messages in the virgin queue, one to the member who was just
diff --git a/src/mailman/docs/styles.txt b/src/mailman/docs/styles.txt
index d12e57b08..7524ecf64 100644
--- a/src/mailman/docs/styles.txt
+++ b/src/mailman/docs/styles.txt
@@ -1,3 +1,4 @@
+===========
List styles
===========
@@ -13,7 +14,7 @@ modify the mailing list any way it wants.
Let's start with a vanilla mailing list and a default style manager.
- >>> mlist = config.db.list_manager.create(u'_xtest@example.com')
+ >>> mlist = config.db.list_manager.create('_xtest@example.com')
>>> from mailman.styles.manager import StyleManager
>>> style_manager = StyleManager()
>>> style_manager.populate()
@@ -22,7 +23,7 @@ Let's start with a vanilla mailing list and a default style manager.
The default style
------------------
+=================
There is a default style which implements the legacy application of list
defaults from previous versions of Mailman. This style only matching a
@@ -49,7 +50,7 @@ manager's `lookup()` method.
Registering styles
-------------------
+==================
New styles must implement the IStyle interface.
@@ -61,7 +62,7 @@ New styles must implement the IStyle interface.
... 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:
@@ -76,15 +77,15 @@ style. This is because the default style only gets applied when no other
styles match the mailing list.
>>> sorted(style.name for style in style_manager.lookup(mlist))
- ['test']
+ [u'test']
>>> for style in style_manager.lookup(mlist):
... style.apply(mlist)
- >>> mlist.msg_footer
- u'test footer'
+ >>> print mlist.msg_footer
+ test footer
Style priority
---------------
+==============
When multiple styles match a particular mailing list, they are applied in
descending order of priority. In other words, a priority zero style would be
@@ -95,16 +96,16 @@ applied last.
... priority = 5
... # Use the base class's match() method.
... def apply(self, mailing_list):
- ... mailing_list.msg_footer = u'another footer'
+ ... mailing_list.msg_footer = 'another footer'
- >>> mlist.msg_footer = u''
+ >>> mlist.msg_footer = ''
>>> mlist.msg_footer
u''
>>> style_manager.register(AnotherTestStyle())
>>> for style in style_manager.lookup(mlist):
... style.apply(mlist)
- >>> mlist.msg_footer
- u'another footer'
+ >>> print mlist.msg_footer
+ another footer
You can change the priority of a style, and if you reapply the styles, they
will take effect in the new priority order.
@@ -115,22 +116,22 @@ will take effect in the new priority order.
>>> style_2.priority = 10
>>> for style in style_manager.lookup(mlist):
... style.apply(mlist)
- >>> mlist.msg_footer
- u'test footer'
+ >>> print mlist.msg_footer
+ test footer
Unregistering styles
---------------------
+====================
You can unregister a style, making it unavailable in the future.
>>> style_manager.unregister(style_2)
>>> sorted(style.name for style in style_manager.lookup(mlist))
- ['test']
+ [u'test']
Corner cases
-------------
+============
If you register a style with the same name as an already registered style, you
get an exception.
@@ -153,4 +154,4 @@ If you try to unregister a style that isn't registered, you get an exception.
>>> style_manager.unregister(style_2)
Traceback (most recent call last):
...
- KeyError: 'another'
+ KeyError: u'another'
diff --git a/src/mailman/docs/usermanager.txt b/src/mailman/docs/usermanager.txt
index f8cbfeef2..3c5369b84 100644
--- a/src/mailman/docs/usermanager.txt
+++ b/src/mailman/docs/usermanager.txt
@@ -1,3 +1,4 @@
+================
The user manager
================
@@ -14,7 +15,7 @@ config object.
Creating users
---------------
+==============
There are several ways you can create a user object. The simplest is to
create a 'blank' user by not providing an address or real name at creation
@@ -39,19 +40,19 @@ The user has preferences, but none of them will be specified.
A user can be assigned a real name.
- >>> user.real_name = u'Anne Person'
+ >>> user.real_name = 'Anne Person'
>>> sorted(user.real_name for user in usermgr.users)
[u'Anne Person']
A user can be assigned a password.
- >>> user.password = u'secret'
+ >>> user.password = 'secret'
>>> sorted(user.password for user in usermgr.users)
[u'secret']
You can also create a user with an address to start out with.
- >>> user_2 = usermgr.create_user(u'bperson@example.com')
+ >>> user_2 = usermgr.create_user('bperson@example.com')
>>> verifyObject(IUser, user_2)
True
>>> sorted(address.address for address in user_2.addresses)
@@ -61,13 +62,13 @@ You can also create a user with an address to start out with.
As above, you can assign a real name to such users.
- >>> user_2.real_name = u'Ben Person'
+ >>> user_2.real_name = 'Ben Person'
>>> sorted(user.real_name for user in usermgr.users)
[u'Anne Person', u'Ben Person']
You can also create a user with just a real name.
- >>> user_3 = usermgr.create_user(real_name=u'Claire Person')
+ >>> user_3 = usermgr.create_user(real_name='Claire Person')
>>> verifyObject(IUser, user_3)
True
>>> sorted(address.address for address in user.addresses)
@@ -77,7 +78,7 @@ You can also create a user with just a real name.
Finally, you can create a user with both an address and a real name.
- >>> user_4 = usermgr.create_user(u'dperson@example.com', u'Dan Person')
+ >>> user_4 = usermgr.create_user('dperson@example.com', 'Dan Person')
>>> verifyObject(IUser, user_3)
True
>>> sorted(address.address for address in user_4.addresses)
@@ -89,7 +90,7 @@ Finally, you can create a user with both an address and a real name.
Deleting users
---------------
+==============
You delete users by going through the user manager. The deleted user is no
longer available through the user manager iterator.
@@ -100,7 +101,7 @@ longer available through the user manager iterator.
Finding users
--------------
+=============
You can ask the user manager to find the IUser that controls a particular
email address. You'll get back the original user object if it's found. Note
@@ -117,7 +118,7 @@ object.
If the address is not in the user database or does not have a user associated
with it, you will get None back.
- >>> print usermgr.get_user(u'zperson@example.com')
+ >>> print usermgr.get_user('zperson@example.com')
None
>>> user_4.unlink(address)
>>> print usermgr.get_user(address.address)
diff --git a/src/mailman/docs/users.txt b/src/mailman/docs/users.txt
index b557a280d..ef4f3062b 100644
--- a/src/mailman/docs/users.txt
+++ b/src/mailman/docs/users.txt
@@ -1,3 +1,4 @@
+=====
Users
=====
@@ -11,13 +12,13 @@ See usermanager.txt for examples of how to create, delete, and find users.
User data
----------
+=========
Users may have a real name and a password.
>>> user_1 = usermgr.create_user()
- >>> user_1.password = u'my password'
- >>> user_1.real_name = u'Zoe Person'
+ >>> user_1.password = 'my password'
+ >>> user_1.real_name = 'Zoe Person'
>>> sorted(user.real_name for user in usermgr.users)
[u'Zoe Person']
>>> sorted(user.password for user in usermgr.users)
@@ -25,8 +26,8 @@ Users may have a real name and a password.
The password and real name can be changed at any time.
- >>> user_1.real_name = u'Zoe X. Person'
- >>> user_1.password = u'another password'
+ >>> user_1.real_name = 'Zoe X. Person'
+ >>> user_1.password = 'another password'
>>> sorted(user.real_name for user in usermgr.users)
[u'Zoe X. Person']
>>> sorted(user.password for user in usermgr.users)
@@ -34,7 +35,7 @@ The password and real name can be changed at any time.
Users addresses
----------------
+===============
One of the pieces of information that a user links to is a set of email
addresses they control, in the form of IAddress objects. A user can control
@@ -43,9 +44,9 @@ many addresses, but addresses may be controlled by only one user.
The easiest way to link a user to an address is to just register the new
address on a user object.
- >>> user_1.register(u'zperson@example.com', u'Zoe Person')
+ >>> user_1.register('zperson@example.com', 'Zoe Person')
<Address: Zoe Person <zperson@example.com> [not verified] at 0x...>
- >>> user_1.register(u'zperson@example.org')
+ >>> user_1.register('zperson@example.org')
<Address: zperson@example.org [not verified] at 0x...>
>>> sorted(address.address for address in user_1.addresses)
[u'zperson@example.com', u'zperson@example.org']
@@ -54,7 +55,7 @@ address on a user object.
You can also create the address separately and then link it to the user.
- >>> address_1 = usermgr.create_address(u'zperson@example.net')
+ >>> address_1 = usermgr.create_address('zperson@example.net')
>>> user_1.link(address_1)
>>> sorted(address.address for address in user_1.addresses)
[u'zperson@example.com', u'zperson@example.net', u'zperson@example.org']
@@ -73,27 +74,27 @@ You can also ask whether a given user controls a given address.
>>> user_1.controls(address_1.address)
True
- >>> user_1.controls(u'bperson@example.com')
+ >>> user_1.controls('bperson@example.com')
False
Given a text email address, the user manager can find the user that controls
that address.
- >>> usermgr.get_user(u'zperson@example.com') is user_1
+ >>> usermgr.get_user('zperson@example.com') is user_1
True
- >>> usermgr.get_user(u'zperson@example.net') is user_1
+ >>> usermgr.get_user('zperson@example.net') is user_1
True
- >>> usermgr.get_user(u'zperson@example.org') is user_1
+ >>> usermgr.get_user('zperson@example.org') is user_1
True
- >>> print usermgr.get_user(u'bperson@example.com')
+ >>> print usermgr.get_user('bperson@example.com')
None
Addresses can also be unlinked from a user.
>>> user_1.unlink(address_1)
- >>> user_1.controls(u'zperson@example.net')
+ >>> user_1.controls('zperson@example.net')
False
- >>> print usermgr.get_user(u'aperson@example.net')
+ >>> print usermgr.get_user('aperson@example.net')
None
But don't try to unlink the address from a user it's not linked to.
@@ -109,7 +110,7 @@ But don't try to unlink the address from a user it's not linked to.
Users and preferences
----------------------
+=====================
This is a helper function for the following section.
@@ -132,12 +133,12 @@ Users have preferences, but these preferences have no default settings.
Some of these preferences are booleans and they can be set to True or False.
- >>> config.languages.add(u'it', u'iso-8859-1', u'Italian')
+ >>> config.languages.add('it', 'iso-8859-1', 'Italian')
>>> from mailman.constants import DeliveryMode
>>> prefs = user_1.preferences
>>> prefs.acknowledge_posts = True
- >>> prefs.preferred_language = u'it'
+ >>> prefs.preferred_language = 'it'
>>> prefs.receive_list_copy = False
>>> prefs.receive_own_postings = False
>>> prefs.delivery_mode = DeliveryMode.regular
@@ -150,7 +151,7 @@ Some of these preferences are booleans and they can be set to True or False.
Subscriptions
--------------
+=============
Users know which mailing lists they are subscribed to, regardless of
membership role.
@@ -158,14 +159,14 @@ membership role.
>>> user_1.link(address_1)
>>> sorted(address.address for address in user_1.addresses)
[u'zperson@example.com', u'zperson@example.net', u'zperson@example.org']
- >>> com = usermgr.get_address(u'zperson@example.com')
- >>> org = usermgr.get_address(u'zperson@example.org')
- >>> net = usermgr.get_address(u'zperson@example.net')
+ >>> com = usermgr.get_address('zperson@example.com')
+ >>> org = usermgr.get_address('zperson@example.org')
+ >>> net = usermgr.get_address('zperson@example.net')
>>> from mailman.app.lifecycle import create_list
- >>> mlist_1 = create_list(u'xtest_1@example.com')
- >>> mlist_2 = create_list(u'xtest_2@example.com')
- >>> mlist_3 = create_list(u'xtest_3@example.com')
+ >>> mlist_1 = create_list('xtest_1@example.com')
+ >>> mlist_2 = create_list('xtest_2@example.com')
+ >>> mlist_3 = create_list('xtest_3@example.com')
>>> from mailman.interfaces.member import MemberRole
>>> com.subscribe(mlist_1, MemberRole.member)
@@ -188,7 +189,8 @@ membership role.
>>> len(members)
4
>>> def sortkey(member):
- ... return member.address.address, member.mailing_list, int(member.role)
+ ... return (member.address.address, member.mailing_list,
+ ... int(member.role))
>>> for member in sorted(members, key=sortkey):
... print member.address.address, member.mailing_list, member.role
zperson@example.com xtest_1@example.com MemberRole.member