summaryrefslogtreecommitdiff
path: root/src/mailman/mta
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/mta
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/mta')
-rw-r--r--src/mailman/mta/bulk.py2
-rw-r--r--src/mailman/mta/connection.py2
-rw-r--r--src/mailman/mta/decorating.py2
-rw-r--r--src/mailman/mta/deliver.py2
-rw-r--r--src/mailman/mta/docs/authentication.rst2
-rw-r--r--src/mailman/mta/docs/bulk.rst24
-rw-r--r--src/mailman/mta/docs/connection.rst4
-rw-r--r--src/mailman/mta/docs/decorating.rst16
-rw-r--r--src/mailman/mta/docs/personalized.rst12
-rw-r--r--src/mailman/mta/docs/verp.rst6
-rw-r--r--src/mailman/mta/personalized.py2
-rw-r--r--src/mailman/mta/tests/test_aliases.py2
-rw-r--r--src/mailman/mta/verp.py2
13 files changed, 39 insertions, 39 deletions
diff --git a/src/mailman/mta/bulk.py b/src/mailman/mta/bulk.py
index da3026083..4255e0c33 100644
--- a/src/mailman/mta/bulk.py
+++ b/src/mailman/mta/bulk.py
@@ -17,7 +17,7 @@
"""Bulk message delivery."""
-from __future__ import absolute_import, unicode_literals
+from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
diff --git a/src/mailman/mta/connection.py b/src/mailman/mta/connection.py
index f5c330921..8cf419545 100644
--- a/src/mailman/mta/connection.py
+++ b/src/mailman/mta/connection.py
@@ -17,7 +17,7 @@
"""MTA connections."""
-from __future__ import absolute_import, unicode_literals
+from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
diff --git a/src/mailman/mta/decorating.py b/src/mailman/mta/decorating.py
index a23e188a1..ac99b3624 100644
--- a/src/mailman/mta/decorating.py
+++ b/src/mailman/mta/decorating.py
@@ -17,7 +17,7 @@
"""Individualized delivery with header/footer decorations."""
-from __future__ import absolute_import, unicode_literals
+from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
diff --git a/src/mailman/mta/deliver.py b/src/mailman/mta/deliver.py
index de6b80a8c..be04a48bd 100644
--- a/src/mailman/mta/deliver.py
+++ b/src/mailman/mta/deliver.py
@@ -17,7 +17,7 @@
"""Generic delivery."""
-from __future__ import absolute_import, unicode_literals
+from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
diff --git a/src/mailman/mta/docs/authentication.rst b/src/mailman/mta/docs/authentication.rst
index 9f78859a0..94cd2c99e 100644
--- a/src/mailman/mta/docs/authentication.rst
+++ b/src/mailman/mta/docs/authentication.rst
@@ -44,7 +44,7 @@ Attempting delivery first must authorize with the mail server.
>>> bulk.deliver(mlist, msg, dict(recipients=['bperson@example.com']))
{}
- >>> print smtpd.get_authentication_credentials()
+ >>> print(smtpd.get_authentication_credentials())
PLAIN AHRlc3R1c2VyAHRlc3RwYXNz
>>> config.pop('auth')
diff --git a/src/mailman/mta/docs/bulk.rst b/src/mailman/mta/docs/bulk.rst
index 8bacd4957..f0c4e0132 100644
--- a/src/mailman/mta/docs/bulk.rst
+++ b/src/mailman/mta/docs/bulk.rst
@@ -95,7 +95,7 @@ a few things. For example, the first two chunks will be composed of ``.net``
3
>>> for address in sorted(chunks[0].union(chunks[1])):
- ... print address
+ ... print(address)
bart@example.org
cate@example.net
elle@example.org
@@ -113,7 +113,7 @@ We also know that the next two chunks will contain ``.com`` (5) addresses.
1
>>> for address in sorted(chunks[2].union(chunks[3])):
- ... print address
+ ... print(address)
anne@example.com
dave@example.com
gwen@example.com
@@ -125,7 +125,7 @@ The next chunk will contain the ``.us`` (2) and ``.ca`` (1) domains.
>>> len(chunks[4])
3
>>> for address in sorted(chunks[4]):
- ... print address
+ ... print(address)
herb@example.us
liam@example.ca
mary@example.us
@@ -136,7 +136,7 @@ The final chunk will contain the outliers, ``.xx`` (1) and ``.zz`` (2).
>>> len(chunks[5])
2
>>> for address in sorted(chunks[5]):
- ... print address
+ ... print(address)
paco@example.xx
quaq@example.zz
@@ -182,7 +182,7 @@ message sent, with all the recipients packed into the envelope recipients
>>> messages = list(smtpd.messages)
>>> len(messages)
1
- >>> print messages[0].as_string()
+ >>> print(messages[0].as_string())
From: aperson@example.org
To: test@example.com
Subject: test one
@@ -212,7 +212,7 @@ each with 20 addresses in the ``RCPT TO``.
5
>>> for message in messages:
... x_rcptto = message['x-rcptto']
- ... print 'Number of recipients:', len(x_rcptto.split(','))
+ ... print('Number of recipients:', len(x_rcptto.split(',')))
Number of recipients: 20
Number of recipients: 20
Number of recipients: 20
@@ -238,7 +238,7 @@ message metadata...
{}
>>> message = list(smtpd.messages)[0]
- >>> print message.as_string()
+ >>> print(message.as_string())
From: aperson@example.org
To: test@example.com
Subject: test one
@@ -257,7 +257,7 @@ message metadata...
{}
>>> message = list(smtpd.messages)[0]
- >>> print message.as_string()
+ >>> print(message.as_string())
From: aperson@example.org
To: test@example.com
Subject: test one
@@ -281,7 +281,7 @@ message.
{}
>>> message = list(smtpd.messages)[0]
- >>> print message.as_string()
+ >>> print(message.as_string())
From: aperson@example.org
To: test@example.com
Subject: test one
@@ -332,7 +332,7 @@ recipients.
>>> failures = bulk.deliver(mlist, msg, msgdata)
>>> for address in sorted(failures):
- ... print address, failures[address][0], failures[address][1]
+ ... print(address, failures[address][0], failures[address][1])
aperson@example.org 500 Error: SMTPRecipientsRefused
bperson@example.org 500 Error: SMTPRecipientsRefused
cperson@example.org 500 Error: SMTPRecipientsRefused
@@ -350,7 +350,7 @@ Or there could be some other problem causing an SMTP response failure.
>>> failures = bulk.deliver(mlist, msg, msgdata)
>>> for address in sorted(failures):
- ... print address, failures[address][0], failures[address][1]
+ ... print(address, failures[address][0], failures[address][1])
aperson@example.org 450 Error: SMTPResponseException
bperson@example.org 450 Error: SMTPResponseException
cperson@example.org 450 Error: SMTPResponseException
@@ -361,7 +361,7 @@ Or there could be some other problem causing an SMTP response failure.
>>> failures = bulk.deliver(mlist, msg, msgdata)
>>> for address in sorted(failures):
- ... print address, failures[address][0], failures[address][1]
+ ... print(address, failures[address][0], failures[address][1])
aperson@example.org 500 Error: SMTPResponseException
bperson@example.org 500 Error: SMTPResponseException
cperson@example.org 500 Error: SMTPResponseException
diff --git a/src/mailman/mta/docs/connection.rst b/src/mailman/mta/docs/connection.rst
index 515a773bd..a57a76bb9 100644
--- a/src/mailman/mta/docs/connection.rst
+++ b/src/mailman/mta/docs/connection.rst
@@ -69,7 +69,7 @@ will authenticate with the mail server after each new connection.
...
... """)
{}
- >>> print smtpd.get_authentication_credentials()
+ >>> print(smtpd.get_authentication_credentials())
PLAIN AHRlc3R1c2VyAHRlc3RwYXNz
>>> reset()
@@ -243,7 +243,7 @@ about accidental deliveries to unintended recipients.
>>> messages = list(smtpd.messages)
>>> len(messages)
1
- >>> print messages[0].as_string()
+ >>> print(messages[0].as_string())
From: anne@example.com
To: bart@example.com
Subject: aardvarks
diff --git a/src/mailman/mta/docs/decorating.rst b/src/mailman/mta/docs/decorating.rst
index cf595b0d5..94331163b 100644
--- a/src/mailman/mta/docs/decorating.rst
+++ b/src/mailman/mta/docs/decorating.rst
@@ -35,17 +35,17 @@ We start by writing the site-global header and footer template.
>>> myheader_path = os.path.join(site_dir, 'myheader.txt')
>>> with open(myheader_path, 'w') as fp:
- ... print >> fp, """\
+ ... print("""\
... Delivery address: $user_address
... Subscribed address: $user_delivered_to
- ... """
+ ... """, file=fp)
>>> myfooter_path = os.path.join(site_dir, 'myfooter.txt')
>>> with open(myfooter_path, 'w') as fp:
- ... print >> fp, """\
+ ... print("""\
... User name: $user_name
... Language: $user_language
... Options: $user_optionsurl
- ... """
+ ... """, file=fp)
Then create a mailing list which will use this header and footer. Because
these are site-global templates, we can use a shorted URL.
@@ -108,8 +108,8 @@ The decorations happen when the message is delivered.
>>> from operator import itemgetter
>>> for message in sorted(messages, key=itemgetter('x-rcptto')):
- ... print message.as_string()
- ... print '----------'
+ ... print(message.as_string())
+ ... print('----------')
From: aperson@example.org
To: test@example.com
Subject: test one
@@ -181,8 +181,8 @@ into the message metadata.
3
>>> for message in sorted(messages, key=itemgetter('x-rcptto')):
- ... print message.as_string()
- ... print '----------'
+ ... print(message.as_string())
+ ... print('----------')
From: aperson@example.org
To: test@example.com
Subject: test one
diff --git a/src/mailman/mta/docs/personalized.rst b/src/mailman/mta/docs/personalized.rst
index 6c1c9eb4f..fdd1a35d5 100644
--- a/src/mailman/mta/docs/personalized.rst
+++ b/src/mailman/mta/docs/personalized.rst
@@ -50,8 +50,8 @@ By default, the ``To:`` header is not personalized.
>>> from operator import itemgetter
>>> for message in sorted(messages, key=itemgetter('x-rcptto')):
- ... print message.as_string()
- ... print '----------'
+ ... print(message.as_string())
+ ... print('----------')
From: aperson@example.org
To: test@example.com
Subject: test one
@@ -102,8 +102,8 @@ with the recipient's address and name.
3
>>> for message in sorted(messages, key=itemgetter('to')):
- ... print message.as_string()
- ... print '----------'
+ ... print(message.as_string())
+ ... print('----------')
From: aperson@example.org
To: aperson@example.com
Subject: test one
@@ -155,8 +155,8 @@ associated real name, then this name also shows up in the ``To:`` header.
>>> from operator import itemgetter
>>> for message in sorted(messages, key=itemgetter('x-rcptto')):
- ... print message.as_string()
- ... print '----------'
+ ... print(message.as_string())
+ ... print('----------')
From: aperson@example.org
To: aperson@example.com
Subject: test one
diff --git a/src/mailman/mta/docs/verp.rst b/src/mailman/mta/docs/verp.rst
index 2f2f09828..181778dc4 100644
--- a/src/mailman/mta/docs/verp.rst
+++ b/src/mailman/mta/docs/verp.rst
@@ -84,8 +84,8 @@ VERPing is only actually done if the metadata requests it.
>>> from operator import itemgetter
>>> for message in sorted(messages, key=itemgetter('x-rcptto')):
- ... print message.as_string()
- ... print '----------'
+ ... print(message.as_string())
+ ... print('----------')
From: aperson@example.org
To: test@example.com
Subject: test one
@@ -119,7 +119,7 @@ VERPing is only actually done if the metadata requests it.
The deliverer made a copy of the original message, so it wasn't changed.
- >>> print msg.as_string()
+ >>> print(msg.as_string())
From: aperson@example.org
To: test@example.com
Subject: test one
diff --git a/src/mailman/mta/personalized.py b/src/mailman/mta/personalized.py
index adc3c90a4..967bca68a 100644
--- a/src/mailman/mta/personalized.py
+++ b/src/mailman/mta/personalized.py
@@ -17,7 +17,7 @@
"""Personalized delivery."""
-from __future__ import absolute_import, unicode_literals
+from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
diff --git a/src/mailman/mta/tests/test_aliases.py b/src/mailman/mta/tests/test_aliases.py
index 2c33c7821..30c57e292 100644
--- a/src/mailman/mta/tests/test_aliases.py
+++ b/src/mailman/mta/tests/test_aliases.py
@@ -17,7 +17,7 @@
"""Test the MTA file generating utility."""
-from __future__ import absolute_import, unicode_literals
+from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [
diff --git a/src/mailman/mta/verp.py b/src/mailman/mta/verp.py
index 968ed58c3..c3d1d0999 100644
--- a/src/mailman/mta/verp.py
+++ b/src/mailman/mta/verp.py
@@ -17,7 +17,7 @@
"""VERP delivery."""
-from __future__ import absolute_import, unicode_literals
+from __future__ import absolute_import, print_function, unicode_literals
__metaclass__ = type
__all__ = [