[Python-checkins] python/dist/src/Lib/email _compat22.py,1.4.2.2,1.4.2.3

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Thu, 03 Apr 2003 18:48:20 -0800


Update of /cvsroot/python/python/dist/src/Lib/email
In directory sc8-pr-cvs1:/tmp/cvs-serv1257

Modified Files:
      Tag: release22-maint
	_compat22.py 
Log Message:
Backporting:

    typed_subpart_iterator(): Fix these to use non-deprecated APIs,
    i.e. get_content_maintype() and get_content_subtype().


Index: _compat22.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat22.py,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -C2 -d -r1.4.2.2 -r1.4.2.3
*** _compat22.py	21 Mar 2003 21:09:31 -0000	1.4.2.2
--- _compat22.py	4 Apr 2003 02:48:18 -0000	1.4.2.3
***************
*** 2,6 ****
  # Author: barry@zope.com
  
! """Module containing compatibility functions for Python 2.1.
  """
  
--- 2,6 ----
  # Author: barry@zope.com
  
! """Module containing compatibility functions for Python 2.2.
  """
  
***************
*** 10,13 ****
--- 10,20 ----
  from types import StringTypes
  
+ # Python 2.2.x where x < 1 lacks True/False
+ try:
+     True, False
+ except NameError:
+     True = 1
+     False = 0
+ 
  
  
***************
*** 59,63 ****
      """
      for subpart in msg.walk():
!         if subpart.get_main_type('text') == maintype:
!             if subtype is None or subpart.get_subtype('plain') == subtype:
                  yield subpart
--- 66,70 ----
      """
      for subpart in msg.walk():
!         if subpart.get_content_maintype() == maintype:
!             if subtype is None or subpart.get_content_subtype() == subtype:
                  yield subpart