[Python-checkins] python/dist/src/Lib/email _compat22.py,1.5,1.6

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Wed, 26 Mar 2003 09:57:27 -0800


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

Modified Files:
	_compat22.py 
Log Message:
typed_subpart_iterator(): Fix these to use non-deprecated APIs,
i.e. get_content_maintype() and get_content_subtype().

Also, add True, False for Python 2.2.x where x < 2 compatibility.


Index: _compat22.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/_compat22.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** _compat22.py	11 Mar 2003 04:41:35 -0000	1.5
--- _compat22.py	26 Mar 2003 17:57:25 -0000	1.6
***************
*** 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 < 2 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