[Python-checkins] python/dist/src/Lib/email Charset.py,1.1,1.2 Header.py,1.2,1.3 Message.py,1.11,1.12 Utils.py,1.14,1.15 base64MIME.py,1.1,1.2 quopriMIME.py,1.1,1.2
tim_one@sourceforge.net
tim_one@sourceforge.net
Thu, 23 May 2002 08:15:32 -0700
- Previous message: [Python-checkins] python/dist/src/Lib StringIO.py,1.25,1.26 fileinput.py,1.12,1.13 macpath.py,1.37,1.38 pickle.py,1.62,1.63 random.py,1.31,1.32 tabnanny.py,1.19,1.20 tokenize.py,1.31,1.32
- Next message: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.16,1.17 test_base64.py,1.1,1.2 test_binascii.py,1.13,1.14 test_isinstance.py,1.2,1.3 test_math.py,1.14,1.15 test_string.py,1.16,1.17 test_unicode.py,1.57,1.58
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib/email
In directory usw-pr-cvs1:/tmp/cvs-serv23840/python/Lib/email
Modified Files:
Charset.py Header.py Message.py Utils.py base64MIME.py
quopriMIME.py
Log Message:
Whitespace normalization.
Index: Charset.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Charset.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Charset.py 10 Apr 2002 21:01:30 -0000 1.1
--- Charset.py 23 May 2002 15:15:29 -0000 1.2
***************
*** 14,18 ****
# In "=?charset?q?hello_world?=", the =?, ?q?, and ?= add up to 7
! MISC_LEN = 7
DEFAULT_CHARSET = 'us-ascii'
--- 14,18 ----
# In "=?charset?q?hello_world?=", the =?, ?q?, and ?= add up to 7
! MISC_LEN = 7
DEFAULT_CHARSET = 'us-ascii'
***************
*** 23,31 ****
CHARSETS = {
# input header enc body enc output conv
! 'iso-8859-1': (QP, QP, None),
'iso-8859-2': (QP, QP, None),
'us-ascii': (None, None, None),
'big5': (BASE64, BASE64, None),
! 'gb2312': (BASE64, BASE64, None),
'euc-jp': (BASE64, None, 'iso-2022-jp'),
'shift_jis': (BASE64, None, 'iso-2022-jp'),
--- 23,31 ----
CHARSETS = {
# input header enc body enc output conv
! 'iso-8859-1': (QP, QP, None),
'iso-8859-2': (QP, QP, None),
'us-ascii': (None, None, None),
'big5': (BASE64, BASE64, None),
! 'gb2312': (BASE64, BASE64, None),
'euc-jp': (BASE64, None, 'iso-2022-jp'),
'shift_jis': (BASE64, None, 'iso-2022-jp'),
***************
*** 126,130 ****
applicable codecs. Given an character set, it will do its best to provide
information on how to use that character set in an email.
!
Certain character sets must be encoded with quoted-printable or base64
when used in email headers or bodies. Certain character sets must be
--- 126,130 ----
applicable codecs. Given an character set, it will do its best to provide
information on how to use that character set in an email.
!
Certain character sets must be encoded with quoted-printable or base64
when used in email headers or bodies. Certain character sets must be
Index: Header.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Header.py 19 May 2002 23:47:53 -0000 1.2
--- Header.py 23 May 2002 15:15:29 -0000 1.3
***************
*** 62,66 ****
decoded.append((line, None))
continue
!
parts = ecre.split(line)
while parts:
--- 62,66 ----
decoded.append((line, None))
continue
!
parts = ecre.split(line)
while parts:
***************
*** 150,154 ****
charset = self._charset
self._chunks.append((s, charset))
!
def _split(self, s, charset):
# Split up a header safely for use with encode_chunks. BAW: this
--- 150,154 ----
charset = self._charset
self._chunks.append((s, charset))
!
def _split(self, s, charset):
# Split up a header safely for use with encode_chunks. BAW: this
***************
*** 157,161 ****
encoded = charset.from_splittable(splittable)
elen = charset.encoded_header_len(encoded)
!
if elen <= self._maxlinelen:
return [(encoded, charset)]
--- 157,161 ----
encoded = charset.from_splittable(splittable)
elen = charset.encoded_header_len(encoded)
!
if elen <= self._maxlinelen:
return [(encoded, charset)]
***************
*** 186,190 ****
75-character length limit on any given encoded header field, so
line-wrapping must be performed, even with double-byte character sets.
!
This method will do its best to convert the string to the correct
character set used in email, and encode and line wrap it safely with
--- 186,190 ----
75-character length limit on any given encoded header field, so
line-wrapping must be performed, even with double-byte character sets.
!
This method will do its best to convert the string to the correct
character set used in email, and encode and line wrap it safely with
Index: Message.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Message.py 19 May 2002 23:44:19 -0000 1.11
--- Message.py 23 May 2002 15:15:30 -0000 1.12
***************
*** 217,221 ****
"""Return the Charset object associated with the message's payload."""
return self._charset
!
#
# MAPPING INTERFACE (partial)
--- 217,221 ----
"""Return the Charset object associated with the message's payload."""
return self._charset
!
#
# MAPPING INTERFACE (partial)
Index: Utils.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Utils.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Utils.py 22 May 2002 01:52:10 -0000 1.14
--- Utils.py 23 May 2002 15:15:30 -0000 1.15
***************
*** 89,93 ****
(realname, email_address) and returns the string value suitable
for an RFC 2822 From:, To: or Cc:.
!
If the first element of pair is false, then the second element is
returned unmodified.
--- 89,93 ----
(realname, email_address) and returns the string value suitable
for an RFC 2822 From:, To: or Cc:.
!
If the first element of pair is false, then the second element is
returned unmodified.
Index: base64MIME.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/base64MIME.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** base64MIME.py 10 Apr 2002 21:01:30 -0000 1.1
--- base64MIME.py 23 May 2002 15:15:30 -0000 1.2
***************
*** 40,50 ****
def base64_len(s):
"""Return the length of s when it is encoded with base64."""
! groups_of_3, leftover = divmod(len(s), 3)
! # 4 bytes out for each 3 bytes (or nonzero fraction thereof) in.
# Thanks, Tim!
! n = groups_of_3 * 4
! if leftover:
! n += 4
! return n
--- 40,50 ----
def base64_len(s):
"""Return the length of s when it is encoded with base64."""
! groups_of_3, leftover = divmod(len(s), 3)
! # 4 bytes out for each 3 bytes (or nonzero fraction thereof) in.
# Thanks, Tim!
! n = groups_of_3 * 4
! if leftover:
! n += 4
! return n
***************
*** 53,57 ****
eol=NL):
"""Encode a single header line with Base64 encoding in a given charset.
!
Defined in RFC 2045, this Base64 encoding is identical to normal Base64
encoding, except that each line must be intelligently wrapped (respecting
--- 53,57 ----
eol=NL):
"""Encode a single header line with Base64 encoding in a given charset.
!
Defined in RFC 2045, this Base64 encoding is identical to normal Base64
encoding, except that each line must be intelligently wrapped (respecting
***************
*** 73,77 ****
"=?charset?b?WW/5ciBtYXp66XLrIHf8eiBhIGhhbXBzdGHuciBBIFlv+XIgbWF6euly?=\\n
=?charset?b?6yB3/HogYSBoYW1wc3Rh7nIgQkMgWW/5ciBtYXp66XLrIHf8eiBhIGhh?="
!
with each line wrapped at, at most, maxlinelen characters (defaults to 76
characters).
--- 73,77 ----
"=?charset?b?WW/5ciBtYXp66XLrIHf8eiBhIGhhbXBzdGHuciBBIFlv+XIgbWF6euly?=\\n
=?charset?b?6yB3/HogYSBoYW1wc3Rh7nIgQkMgWW/5ciBtYXp66XLrIHf8eiBhIGhh?="
!
with each line wrapped at, at most, maxlinelen characters (defaults to 76
characters).
***************
*** 83,87 ****
if not keep_eols:
header = fix_eols(header)
!
# Base64 encode each line, in encoded chunks no greater than maxlinelen in
# length, after the RFC chrome is added in.
--- 83,87 ----
if not keep_eols:
header = fix_eols(header)
!
# Base64 encode each line, in encoded chunks no greater than maxlinelen in
# length, after the RFC chrome is added in.
***************
*** 92,96 ****
# BAW: Ben's original code used a step of max_unencoded, but I think it
# ought to be max_encoded. Otherwise, where's max_encoded used? I'm
! # still not sure what the
for i in range(0, len(header), max_unencoded):
base64ed.append(b2a_base64(header[i:i+max_unencoded]))
--- 92,96 ----
# BAW: Ben's original code used a step of max_unencoded, but I think it
# ought to be max_encoded. Otherwise, where's max_encoded used? I'm
! # still not sure what the
for i in range(0, len(header), max_unencoded):
base64ed.append(b2a_base64(header[i:i+max_unencoded]))
***************
*** 127,134 ****
if not s:
return s
!
if not binary:
s = fix_eols(s)
!
encvec = []
max_unencoded = maxlinelen * 3 / 4
--- 127,134 ----
if not s:
return s
!
if not binary:
s = fix_eols(s)
!
encvec = []
max_unencoded = maxlinelen * 3 / 4
***************
*** 163,167 ****
if not s:
return s
!
dec = a2b_base64(s)
if convert_eols:
--- 163,167 ----
if not s:
return s
!
dec = a2b_base64(s)
if convert_eols:
Index: quopriMIME.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/quopriMIME.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** quopriMIME.py 10 Apr 2002 21:01:30 -0000 1.1
--- quopriMIME.py 23 May 2002 15:15:30 -0000 1.2
***************
*** 23,27 ****
conversion necessary for proper internationalized headers; it only
does dumb encoding and decoding. To deal with the various line
! wrapping issues, use the email.Header module.
"""
--- 23,27 ----
conversion necessary for proper internationalized headers; it only
does dumb encoding and decoding. To deal with the various line
! wrapping issues, use the email.Header module.
"""
***************
*** 51,55 ****
return bqre.match(c) and 1
!
def header_quopri_len(s):
"""Return the length of str when it is encoded with header quopri."""
--- 51,55 ----
return bqre.match(c) and 1
!
def header_quopri_len(s):
"""Return the length of str when it is encoded with header quopri."""
***************
*** 132,136 ****
quoted = []
max_encoded = maxlinelen - len(charset) - MISC_LEN
!
for c in header:
# Space may be represented as _ instead of =20 for readability
--- 132,136 ----
quoted = []
max_encoded = maxlinelen - len(charset) - MISC_LEN
!
for c in header:
# Space may be represented as _ instead of =20 for readability
***************
*** 188,192 ****
elif line[-1] in CRLF:
line = line[:-1]
!
lineno += 1
encoded_line = ''
--- 188,192 ----
elif line[-1] in CRLF:
line = line[:-1]
!
lineno += 1
encoded_line = ''
- Previous message: [Python-checkins] python/dist/src/Lib StringIO.py,1.25,1.26 fileinput.py,1.12,1.13 macpath.py,1.37,1.38 pickle.py,1.62,1.63 random.py,1.31,1.32 tabnanny.py,1.19,1.20 tokenize.py,1.31,1.32
- Next message: [Python-checkins] python/dist/src/Lib/test string_tests.py,1.16,1.17 test_base64.py,1.1,1.2 test_binascii.py,1.13,1.14 test_isinstance.py,1.2,1.3 test_math.py,1.14,1.15 test_string.py,1.16,1.17 test_unicode.py,1.57,1.58
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]