[Python-checkins] python/dist/src/Lib/email Header.py,1.27,1.28
bwarsaw at users.sourceforge.net
bwarsaw at users.sourceforge.net
Sat May 8 23:40:20 EDT 2004
Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12766
Modified Files:
Header.py
Log Message:
Update to Python 2.3, getting rid of backward compatiblity crud. Get rid of a
bunch of module globals that aren't used.
Index: Header.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Header.py 30 Mar 2003 20:46:47 -0000 1.27
--- Header.py 9 May 2004 03:40:17 -0000 1.28
***************
*** 1,4 ****
! # Copyright (C) 2002 Python Software Foundation
! # Author: che at debian.org (Ben Gertzfield), barry at zope.com (Barry Warsaw)
"""Header encoding and decoding functionality."""
--- 1,4 ----
! # Copyright (C) 2002-2004 Python Software Foundation
! # Author: che at debian.org (Ben Gertzfield), barry at python.org (Barry Warsaw)
"""Header encoding and decoding functionality."""
***************
*** 6,10 ****
import re
import binascii
- from types import StringType, UnicodeType
import email.quopriMIME
--- 6,9 ----
***************
*** 13,42 ****
from email.Charset import Charset
- try:
- from email._compat22 import _floordiv
- except SyntaxError:
- # Python 2.1 spells integer division differently
- from email._compat21 import _floordiv
-
- try:
- True, False
- except NameError:
- True = 1
- False = 0
-
- CRLFSPACE = '\r\n '
- CRLF = '\r\n'
NL = '\n'
SPACE = ' '
USPACE = u' '
SPACE8 = ' ' * 8
- EMPTYSTRING = ''
UEMPTYSTRING = u''
MAXLINELEN = 76
- ENCODE = 1
- DECODE = 2
-
USASCII = Charset('us-ascii')
UTF8 = Charset('utf-8')
--- 12,23 ----
***************
*** 53,58 ****
''', re.VERBOSE | re.IGNORECASE)
- pcre = re.compile('([,;])')
-
# Field name regexp, including trailing colon, but not separating whitespace,
# according to RFC 2822. Character range is from tilde to exclamation mark.
--- 34,37 ----
***************
*** 245,250 ****
s may be a byte string or a Unicode string. If it is a byte string
! (i.e. isinstance(s, StringType) is true), then charset is the encoding
! of that byte string, and a UnicodeError will be raised if the string
cannot be decoded with that charset. If s is a Unicode string, then
charset is a hint specifying the character set of the characters in
--- 224,229 ----
s may be a byte string or a Unicode string. If it is a byte string
! (i.e. isinstance(s, str) is true), then charset is the encoding of
! that byte string, and a UnicodeError will be raised if the string
cannot be decoded with that charset. If s is a Unicode string, then
charset is a hint specifying the character set of the characters in
***************
*** 266,270 ****
# back to a byte string, given the input and output codecs of the
# charset.
! if isinstance(s, StringType):
# Possibly raise UnicodeError if the byte string can't be
# converted to a unicode with the input codec of the charset.
--- 245,249 ----
# back to a byte string, given the input and output codecs of the
# charset.
! if isinstance(s, str):
# Possibly raise UnicodeError if the byte string can't be
# converted to a unicode with the input codec of the charset.
***************
*** 276,280 ****
outcodec = charset.output_codec or 'us-ascii'
ustr.encode(outcodec, errors)
! elif isinstance(s, UnicodeType):
# Now we have to be sure the unicode string can be converted
# to a byte string with a reasonable output codec. We want to
--- 255,259 ----
outcodec = charset.output_codec or 'us-ascii'
ustr.encode(outcodec, errors)
! elif isinstance(s, unicode):
# Now we have to be sure the unicode string can be converted
# to a byte string with a reasonable output codec. We want to
More information about the Python-checkins
mailing list