summaryrefslogtreecommitdiffstats
path: root/Lib/email/generator.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-02-09 05:37:30 (GMT)
committerGuido van Rossum <guido@python.org>2007-02-09 05:37:30 (GMT)
commitbe19ed77ddb047e02fe94d142181062af6d99dcc (patch)
tree70f214e06554046fcccbadeb78665f25e07ce965 /Lib/email/generator.py
parent452bf519a70c3db0e7f0d2540b1bfb07d9085583 (diff)
downloadcpython-be19ed77ddb047e02fe94d142181062af6d99dcc.zip
cpython-be19ed77ddb047e02fe94d142181062af6d99dcc.tar.gz
cpython-be19ed77ddb047e02fe94d142181062af6d99dcc.tar.bz2
Fix most trivially-findable print statements.
There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.)
Diffstat (limited to 'Lib/email/generator.py')
-rw-r--r--Lib/email/generator.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/Lib/email/generator.py b/Lib/email/generator.py
index ed832a3..4f3fea4 100644
--- a/Lib/email/generator.py
+++ b/Lib/email/generator.py
@@ -80,7 +80,7 @@ class Generator:
ufrom = msg.get_unixfrom()
if not ufrom:
ufrom = 'From nobody ' + time.ctime(time.time())
- print >> self._fp, ufrom
+ print(ufrom, file=self._fp)
self._write(msg)
def clone(self, fp):
@@ -140,13 +140,13 @@ class Generator:
def _write_headers(self, msg):
for h, v in msg.items():
- print >> self._fp, '%s:' % h,
+ print('%s:' % h, end=' ', file=self._fp)
if self._maxheaderlen == 0:
# Explicit no-wrapping
- print >> self._fp, v
+ print(v, file=self._fp)
elif isinstance(v, Header):
# Header instances know what to do
- print >> self._fp, v.encode()
+ print(v.encode(), file=self._fp)
elif _is8bitstring(v):
# If we have raw 8bit data in a byte string, we have no idea
# what the encoding is. There is no safe way to split this
@@ -154,14 +154,14 @@ class Generator:
# ascii split, but if it's multibyte then we could break the
# string. There's no way to know so the least harm seems to
# be to not split the string and risk it being too long.
- print >> self._fp, v
+ print(v, file=self._fp)
else:
# Header's got lots of smarts, so use it.
- print >> self._fp, Header(
+ print(Header(
v, maxlinelen=self._maxheaderlen,
- header_name=h, continuation_ws='\t').encode()
+ header_name=h, continuation_ws='\t').encode(), file=self._fp)
# A blank line always separates headers from body
- print >> self._fp
+ print(file=self._fp)
#
# Handlers for writing types and subtypes
@@ -215,9 +215,9 @@ class Generator:
msg.set_boundary(boundary)
# If there's a preamble, write it out, with a trailing CRLF
if msg.preamble is not None:
- print >> self._fp, msg.preamble
+ print(msg.preamble, file=self._fp)
# dash-boundary transport-padding CRLF
- print >> self._fp, '--' + boundary
+ print('--' + boundary, file=self._fp)
# body-part
if msgtexts:
self._fp.write(msgtexts.pop(0))
@@ -226,13 +226,13 @@ class Generator:
# --> CRLF body-part
for body_part in msgtexts:
# delimiter transport-padding CRLF
- print >> self._fp, '\n--' + boundary
+ print('\n--' + boundary, file=self._fp)
# body-part
self._fp.write(body_part)
# close-delimiter transport-padding
self._fp.write('\n--' + boundary + '--')
if msg.epilogue is not None:
- print >> self._fp
+ print(file=self._fp)
self._fp.write(msg.epilogue)
def _handle_message_delivery_status(self, msg):
@@ -308,12 +308,12 @@ class DecodedGenerator(Generator):
for part in msg.walk():
maintype = part.get_content_maintype()
if maintype == 'text':
- print >> self, part.get_payload(decode=True)
+ print(part.get_payload(decode=True), file=self)
elif maintype == 'multipart':
# Just skip this
pass
else:
- print >> self, self._fmt % {
+ print(self._fmt % {
'type' : part.get_content_type(),
'maintype' : part.get_content_maintype(),
'subtype' : part.get_content_subtype(),
@@ -322,7 +322,7 @@ class DecodedGenerator(Generator):
'[no description]'),
'encoding' : part.get('Content-Transfer-Encoding',
'[no encoding]'),
- }
+ }, file=self)