Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(5)

Side by Side Diff: Lib/email/generator.py

Issue 2407: [issue1974] Use space character as continuation_ws (Closed) SVN Base: http://svn.python.org/view/*checkout*/python/trunk/
Patch Set: Created 1 year, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2001-2006 Python Software Foundation 1 # Copyright (C) 2001-2006 Python Software Foundation
2 # Author: Barry Warsaw 2 # Author: Barry Warsaw
3 # Contact: email-sig@python.org 3 # Contact: email-sig@python.org
4 4
5 """Classes to generate plain text from a message object tree.""" 5 """Classes to generate plain text from a message object tree."""
6 6
7 __all__ = ['Generator', 'DecodedGenerator'] 7 __all__ = ['Generator', 'DecodedGenerator']
8 8
9 import re 9 import re
10 import sys 10 import sys
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 # what the encoding is. There is no safe way to split this 152 # what the encoding is. There is no safe way to split this
153 # string. If it's ascii-subset, then we could do a normal 153 # string. If it's ascii-subset, then we could do a normal
154 # ascii split, but if it's multibyte then we could break the 154 # ascii split, but if it's multibyte then we could break the
155 # string. There's no way to know so the least harm seems to 155 # string. There's no way to know so the least harm seems to
156 # be to not split the string and risk it being too long. 156 # be to not split the string and risk it being too long.
157 print >> self._fp, v 157 print >> self._fp, v
158 else: 158 else:
159 # Header's got lots of smarts, so use it. 159 # Header's got lots of smarts, so use it.
160 print >> self._fp, Header( 160 print >> self._fp, Header(
161 v, maxlinelen=self._maxheaderlen, 161 v, maxlinelen=self._maxheaderlen,
162 header_name=h, continuation_ws='\t').encode() 162 header_name=h).encode()
163 # A blank line always separates headers from body 163 # A blank line always separates headers from body
164 print >> self._fp 164 print >> self._fp
165 165
166 # 166 #
167 # Handlers for writing types and subtypes 167 # Handlers for writing types and subtypes
168 # 168 #
169 169
170 def _handle_text(self, msg): 170 def _handle_text(self, msg):
171 payload = msg.get_payload() 171 payload = msg.get_payload()
172 if payload is None: 172 if payload is None:
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 return boundary 339 return boundary
340 b = boundary 340 b = boundary
341 counter = 0 341 counter = 0
342 while True: 342 while True:
343 cre = re.compile('^--' + re.escape(b) + '(--)?$', re.MULTILINE) 343 cre = re.compile('^--' + re.escape(b) + '(--)?$', re.MULTILINE)
344 if not cre.search(text): 344 if not cre.search(text):
345 break 345 break
346 b = boundary + '.' + str(counter) 346 b = boundary + '.' + str(counter)
347 counter += 1 347 counter += 1
348 return b 348 return b
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld r483