[Python-checkins] python/dist/src/Lib/email Message.py,1.35,1.36 (original) (raw)
bwarsaw at users.sourceforge.net bwarsaw at users.sourceforge.net
Sat May 8 23:44:58 EDT 2004
- Previous message: [Python-checkins] python/dist/src/Lib/email Iterators.py,1.12,1.13
- Next message: [Python-checkins] python/dist/src/Lib/email Parser.py,1.21,1.22
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /cvsroot/python/python/dist/src/Lib/email In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13586
Modified Files: Message.py Log Message: Update to Python 2.3, getting rid of backward compatiblity crud.
Index: Message.py
RCS file: /cvsroot/python/python/dist/src/Lib/email/Message.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** Message.py 20 Oct 2003 14:01:51 -0000 1.35
--- Message.py 9 May 2004 03:44:55 -0000 1.36
***************
*** 1,7 ****
! # Copyright (C) 2001,2002 Python Software Foundation
! # Author: barry at zope.com (Barry Warsaw)
! """Basic message object for the email package object model.
! """
import re
--- 1,6 ----
! # Copyright (C) 2001-2004 Python Software Foundation
! # Author: barry at python.org (Barry Warsaw)
! """Basic message object for the email package object model."""
import re
***************
*** 10,14 ****
import warnings
from cStringIO import StringIO
- from types import ListType, TupleType, StringType
# Intrapackage imports
--- 9,12 ----
***************
*** 19,28 ****
SEMISPACE = '; '
- try:
- True, False
- except NameError:
- True = 1
- False = 0
Regular expression used to split header parameters. BAW: this may be too
simple. It isn't strictly RFC 2045 (section 5.1) compliant, but it catches
--- 17,20 ----
***************
*** 43,50 ****
"""
if value is not None and len(value) > 0:
! # TupleType is used for RFC 2231 encoded parameter values where items
# are (charset, language, value). charset is a string, not a Charset
# instance.
! if isinstance(value, TupleType):
# Encode as per RFC 2231
param += ''
--- 35,42 ----
"""
if value is not None and len(value) > 0:
! # A tuple is used for RFC 2231 encoded parameter values where items
# are (charset, language, value). charset is a string, not a Charset
# instance.
! if isinstance(value, tuple):
# Encode as per RFC 2231
param += ''
***************
*** 78,82 ****
def _unquotevalue(value):
! if isinstance(value, TupleType):
return value[0], value[1], Utils.unquote(value[2])
else:
--- 70,74 ----
def _unquotevalue(value):
! if isinstance(value, tuple):
return value[0], value[1], Utils.unquote(value[2])
else:
***************
*** 133,137 ****
def is_multipart(self):
"""Return True if the message consists of multiple parts."""
! if isinstance(self._payload, ListType):
return True
return False
--- 125,129 ----
def is_multipart(self):
"""Return True if the message consists of multiple parts."""
! if isinstance(self._payload, list):
return True
return False
***************
*** 161,165 ****
if self._payload is None:
self._payload = payload
! elif isinstance(self._payload, ListType):
self._payload.append(payload)
elif self.get_main_type() not in (None, 'multipart'):
--- 153,157 ----
if self._payload is None:
self._payload = payload
! elif isinstance(self._payload, list):
self._payload.append(payload)
elif self.get_main_type() not in (None, 'multipart'):
***************
*** 203,207 ****
if i is None:
payload = self._payload
! elif not isinstance(self._payload, ListType):
raise TypeError, 'Expected list, got %s' % type(self._payload)
else:
--- 195,199 ----
if i is None:
payload = self._payload
! elif not isinstance(self._payload, list):
raise TypeError, 'Expected list, got %s' % type(self._payload)
else:
***************
*** 260,264 ****
self._charset = None
return
! if isinstance(charset, StringType):
charset = Charset.Charset(charset)
if not isinstance(charset, Charset.Charset):
--- 252,256 ----
self._charset = None
return
! if isinstance(charset, str):
charset = Charset.Charset(charset)
if not isinstance(charset, Charset.Charset):
***************
*** 632,636 ****
to the empty string. Both charset and language should be strings.
"""
! if not isinstance(value, TupleType) and charset:
value = (charset, language, value)
--- 624,628 ----
to the empty string. Both charset and language should be strings.
"""
! if not isinstance(value, tuple) and charset:
value = (charset, language, value)
***************
*** 726,730 ****
if filename is missing:
return failobj
! if isinstance(filename, TupleType):
# It's an RFC 2231 encoded parameter
newvalue = _unquotevalue(filename)
--- 718,722 ----
if filename is missing:
return failobj
! if isinstance(filename, tuple):
# It's an RFC 2231 encoded parameter
newvalue = _unquotevalue(filename)
***************
*** 744,748 ****
if boundary is missing:
return failobj
! if isinstance(boundary, TupleType):
# RFC 2231 encoded, so decode. It better end up as ascii
charset = boundary[0] or 'us-ascii'
--- 736,740 ----
if boundary is missing:
return failobj
! if isinstance(boundary, tuple):
# RFC 2231 encoded, so decode. It better end up as ascii
charset = boundary[0] or 'us-ascii'
***************
*** 795,804 ****
self._headers = newheaders
- try:
- from email._compat22 import walk
- except SyntaxError:
- # Must be using Python 2.1
- from email._compat21 import walk
def get_content_charset(self, failobj=None):
"""Return the charset parameter of the Content-Type header.
--- 787,790 ----
*** 812,816 **** if charset is missing: return failobj ! if isinstance(charset, TupleType): # RFC 2231 encoded, so decode it, and it better end up as ascii. pcharset = charset[0] or 'us-ascii' --- 798,802 ---- if charset is missing: return failobj ! if isinstance(charset, tuple): # RFC 2231 encoded, so decode it, and it better end up as ascii. pcharset = charset[0] or 'us-ascii'
*** 836,837 **** --- 822,826 ---- """ return [part.get_content_charset(failobj) for part in self.walk()]
+
# I.e. def walk(self): ...
from email.Iterators import walk
- Previous message: [Python-checkins] python/dist/src/Lib/email Iterators.py,1.12,1.13
- Next message: [Python-checkins] python/dist/src/Lib/email Parser.py,1.21,1.22
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]