summaryrefslogtreecommitdiff
path: root/src/mailman/rules/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/rules/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/rules/docs')
-rw-r--r--src/mailman/rules/docs/administrivia.rst2
-rw-r--r--src/mailman/rules/docs/approved.rst18
-rw-r--r--src/mailman/rules/docs/header-matching.rst16
-rw-r--r--src/mailman/rules/docs/implicit-dest.rst2
-rw-r--r--src/mailman/rules/docs/loop.rst2
-rw-r--r--src/mailman/rules/docs/max-size.rst2
-rw-r--r--src/mailman/rules/docs/moderation.rst8
-rw-r--r--src/mailman/rules/docs/news-moderation.rst2
-rw-r--r--src/mailman/rules/docs/no-subject.rst2
-rw-r--r--src/mailman/rules/docs/recipients.rst2
-rw-r--r--src/mailman/rules/docs/rules.rst4
-rw-r--r--src/mailman/rules/docs/suspicious.rst2
12 files changed, 31 insertions, 31 deletions
diff --git a/src/mailman/rules/docs/administrivia.rst b/src/mailman/rules/docs/administrivia.rst
index bfc5efdcc..679d7aad8 100644
--- a/src/mailman/rules/docs/administrivia.rst
+++ b/src/mailman/rules/docs/administrivia.rst
@@ -10,7 +10,7 @@ the ``-request`` robot address.
>>> mlist = create_list('_xtest@example.com')
>>> mlist.administrivia = True
>>> rule = config.rules['administrivia']
- >>> print rule.name
+ >>> print(rule.name)
administrivia
For example, if the ``Subject:`` header contains the word ``unsubscribe``, the
diff --git a/src/mailman/rules/docs/approved.rst b/src/mailman/rules/docs/approved.rst
index 3f3d54455..2e49e0458 100644
--- a/src/mailman/rules/docs/approved.rst
+++ b/src/mailman/rules/docs/approved.rst
@@ -27,7 +27,7 @@ The ``approved`` rule determines whether the message contains the proper
approval or not.
>>> rule = config.rules['approved']
- >>> print rule.name
+ >>> print(rule.name)
approved
@@ -102,7 +102,7 @@ the ``Approved`` header (LP: #973790) when it matches.
>>> msg['Approved'] = 'super secret'
>>> rule.check(mlist, msg, {})
True
- >>> print msg['approved']
+ >>> print(msg['approved'])
None
It also removes the header when it doesn't match. If the rule didn't do this,
@@ -111,7 +111,7 @@ then the mailing list could be probed for its moderator password.
>>> msg['Approved'] = 'not the password'
>>> rule.check(mlist, msg, {})
False
- >>> print msg['approved']
+ >>> print(msg['approved'])
None
@@ -135,7 +135,7 @@ payload of the message. If this pseudo-header looks like a matching
The pseudo-header is always removed from the body of plain text messages.
- >>> print msg.as_string()
+ >>> print(msg.as_string())
From: aperson@example.com
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
@@ -157,7 +157,7 @@ the pseudo-header line is still removed.
>>> rule.check(mlist, msg, {})
False
- >>> print msg.as_string()
+ >>> print(msg.as_string())
From: aperson@example.com
Content-Transfer-Encoding: 7bit
MIME-Version: 1.0
@@ -197,7 +197,7 @@ be used with MIME documents.
Like before, the pseudo-header is removed, but only from the text parts.
- >>> print msg.as_string()
+ >>> print(msg.as_string())
From: aperson@example.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="AAA"
@@ -242,7 +242,7 @@ If the correct password is in the non-``text/plain`` part, it is ignored.
Pseudo-header is still stripped, but only from the ``text/plain`` part.
- >>> print msg.as_string()
+ >>> print(msg.as_string())
From: aperson@example.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="AAA"
@@ -297,7 +297,7 @@ anything that looks like an ``Approved:`` header.
And the header-like text in the ``text/html`` part was stripped.
- >>> print msg.as_string()
+ >>> print(msg.as_string())
From: aperson@example.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="AAA"
@@ -354,7 +354,7 @@ given).
>>> rule.check(mlist, msg, {})
False
- >>> print msg.as_string()
+ >>> print(msg.as_string())
From: aperson@example.com
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="AAA"
diff --git a/src/mailman/rules/docs/header-matching.rst b/src/mailman/rules/docs/header-matching.rst
index 20e55fadd..3c175e6e1 100644
--- a/src/mailman/rules/docs/header-matching.rst
+++ b/src/mailman/rules/docs/header-matching.rst
@@ -34,20 +34,20 @@ through the chain with no matches.
>>> def hits_and_misses(msgdata):
... hits = msgdata.get('rule_hits', [])
... if len(hits) == 0:
- ... print 'No rules hit'
+ ... print('No rules hit')
... else:
- ... print 'Rule hits:'
+ ... print('Rule hits:')
... for rule_name in hits:
... rule = config.rules[rule_name]
- ... print ' {0}: {1}'.format(rule.header, rule.pattern)
+ ... print(' {0}: {1}'.format(rule.header, rule.pattern))
... misses = msgdata.get('rule_misses', [])
... if len(misses) == 0:
- ... print 'No rules missed'
+ ... print('No rules missed')
... else:
- ... print 'Rule misses:'
+ ... print('Rule misses:')
... for rule_name in misses:
... rule = config.rules[rule_name]
- ... print ' {0}: {1}'.format(rule.header, rule.pattern)
+ ... print(' {0}: {1}'.format(rule.header, rule.pattern))
By looking at the message metadata after chain processing, we can see that
none of the rules matched.
@@ -78,8 +78,8 @@ matches, it gets held for moderator approval.
>>> from mailman.testing.helpers import event_subscribers
>>> def handler(event):
... if isinstance(event, ChainEvent):
- ... print event.__class__.__name__, \
- ... event.chain.name, event.msg['message-id']
+ ... print(event.__class__.__name__,
+ ... event.chain.name, event.msg['message-id'])
>>> del msg['x-spam-score']
>>> msg['X-Spam-Score'] = '*****'
diff --git a/src/mailman/rules/docs/implicit-dest.rst b/src/mailman/rules/docs/implicit-dest.rst
index b0464d0a5..89d2459b0 100644
--- a/src/mailman/rules/docs/implicit-dest.rst
+++ b/src/mailman/rules/docs/implicit-dest.rst
@@ -7,7 +7,7 @@ not explicitly mentioned in the set of message recipients.
>>> mlist = create_list('_xtest@example.com')
>>> rule = config.rules['implicit-dest']
- >>> print rule.name
+ >>> print(rule.name)
implicit-dest
In order to check for implicit destinations, we need to adapt the mailing list
diff --git a/src/mailman/rules/docs/loop.rst b/src/mailman/rules/docs/loop.rst
index 716029065..3b267f0ee 100644
--- a/src/mailman/rules/docs/loop.rst
+++ b/src/mailman/rules/docs/loop.rst
@@ -7,7 +7,7 @@ RFC 2369 ``List-Post:`` header with the value of the list's posting address.
>>> mlist = create_list('_xtest@example.com')
>>> rule = config.rules['loop']
- >>> print rule.name
+ >>> print(rule.name)
loop
The header could be missing, in which case the rule does not match.
diff --git a/src/mailman/rules/docs/max-size.rst b/src/mailman/rules/docs/max-size.rst
index 87856f0f1..b792202cb 100644
--- a/src/mailman/rules/docs/max-size.rst
+++ b/src/mailman/rules/docs/max-size.rst
@@ -9,7 +9,7 @@ bytes).
>>> mlist = create_list('_xtest@example.com')
>>> rule = config.rules['max-size']
- >>> print rule.name
+ >>> print(rule.name)
max-size
For example, setting the maximum message size to 1 means that any message
diff --git a/src/mailman/rules/docs/moderation.rst b/src/mailman/rules/docs/moderation.rst
index 3000f23a2..5631c882d 100644
--- a/src/mailman/rules/docs/moderation.rst
+++ b/src/mailman/rules/docs/moderation.rst
@@ -17,7 +17,7 @@ Member moderation
=================
>>> member_rule = config.rules['member-moderation']
- >>> print member_rule.name
+ >>> print(member_rule.name)
member-moderation
Anne, a mailing list member, sends a message to the mailing list. Her
@@ -27,7 +27,7 @@ postings are not moderated.
>>> from mailman.testing.helpers import subscribe
>>> subscribe(mlist, 'Anne')
>>> member = mlist.members.get_member('aperson@example.com')
- >>> print member.moderation_action
+ >>> print(member.moderation_action)
Action.defer
Because Anne is not moderated, the member moderation rule does not match.
@@ -62,7 +62,7 @@ Nonmembers are handled in a similar way, although by default, nonmember
postings are held for moderator approval.
>>> nonmember_rule = config.rules['nonmember-moderation']
- >>> print nonmember_rule.name
+ >>> print(nonmember_rule.name)
nonmember-moderation
Bart, who is not a member of the mailing list, sends a message to the list.
@@ -70,7 +70,7 @@ Bart, who is not a member of the mailing list, sends a message to the list.
>>> from mailman.interfaces.member import MemberRole
>>> subscribe(mlist, 'Bart', MemberRole.nonmember)
>>> nonmember = mlist.nonmembers.get_member('bperson@example.com')
- >>> print nonmember.moderation_action
+ >>> print(nonmember.moderation_action)
Action.hold
When Bart is registered as a nonmember of the list, his moderation action is
diff --git a/src/mailman/rules/docs/news-moderation.rst b/src/mailman/rules/docs/news-moderation.rst
index 0400c8d9f..b77bc4dc1 100644
--- a/src/mailman/rules/docs/news-moderation.rst
+++ b/src/mailman/rules/docs/news-moderation.rst
@@ -11,7 +11,7 @@ directly to the mailing list.
>>> mlist = create_list('_xtest@example.com')
>>> rule = config.rules['news-moderation']
- >>> print rule.name
+ >>> print(rule.name)
news-moderation
Set the list configuration variable to enable newsgroup moderation.
diff --git a/src/mailman/rules/docs/no-subject.rst b/src/mailman/rules/docs/no-subject.rst
index 4876bc82c..5166100e2 100644
--- a/src/mailman/rules/docs/no-subject.rst
+++ b/src/mailman/rules/docs/no-subject.rst
@@ -7,7 +7,7 @@ is the empty string when stripped.
>>> mlist = create_list('_xtest@example.com')
>>> rule = config.rules['no-subject']
- >>> print rule.name
+ >>> print(rule.name)
no-subject
A message with a non-empty subject does not match the rule.
diff --git a/src/mailman/rules/docs/recipients.rst b/src/mailman/rules/docs/recipients.rst
index aabf397a5..fa0d5be55 100644
--- a/src/mailman/rules/docs/recipients.rst
+++ b/src/mailman/rules/docs/recipients.rst
@@ -7,7 +7,7 @@ explicit recipients addressed by the message.
>>> mlist = create_list('_xtest@example.com')
>>> rule = config.rules['max-recipients']
- >>> print rule.name
+ >>> print(rule.name)
max-recipients
In this case, we'll create a message with five recipients. These include all
diff --git a/src/mailman/rules/docs/rules.rst b/src/mailman/rules/docs/rules.rst
index 3c2eab04d..e2ff747b9 100644
--- a/src/mailman/rules/docs/rules.rst
+++ b/src/mailman/rules/docs/rules.rst
@@ -17,7 +17,7 @@ names to rule objects.
>>> from mailman.interfaces.rules import IRule
>>> for rule_name in sorted(config.rules):
... rule = config.rules[rule_name]
- ... print rule_name, verifyObject(IRule, rule)
+ ... print(rule_name, verifyObject(IRule, rule))
administrivia True
any True
approved True
@@ -58,7 +58,7 @@ For example, the ``emergency`` rule just checks to see if the emergency flag
is set on the mailing list, and the message has not been pre-approved by the
list administrator.
- >>> print rule.name
+ >>> print(rule.name)
emergency
>>> mlist.emergency = False
>>> rule.check(mlist, msg, {})
diff --git a/src/mailman/rules/docs/suspicious.rst b/src/mailman/rules/docs/suspicious.rst
index 9eb8ae7ae..213af5384 100644
--- a/src/mailman/rules/docs/suspicious.rst
+++ b/src/mailman/rules/docs/suspicious.rst
@@ -8,7 +8,7 @@ confusing to users, and the list attribute that controls this is misnamed.
>>> mlist = create_list('_xtest@example.com')
>>> rule = config.rules['suspicious-header']
- >>> print rule.name
+ >>> print(rule.name)
suspicious-header
Set the so-called suspicious header configuration variable.