[Python-checkins] CVS: python/dist/src/Lib/email Iterators.py,1.1,1.2

Barry Warsaw bwarsaw@users.sourceforge.net
Tue, 25 Sep 2001 22:35:50 -0700


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

Modified Files:
	Iterators.py 
Log Message:
Updated docstrings.  Also,

typed_subpart_iterator(): Arguments major renamed to maintype and
    minor renamed to subtype for consistency with the rest of the
    package.


Index: Iterators.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Iterators.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Iterators.py	2001/09/23 03:17:28	1.1
--- Iterators.py	2001/09/26 05:35:47	1.2
***************
*** 12,16 ****
  
  def body_line_iterator(msg):
!     """Iterator over the parts, returning the lines in a string payload."""
      for subpart in msg.walk():
          payload = subpart.get_payload()
--- 12,16 ----
  
  def body_line_iterator(msg):
!     """Iterate over the parts, returning string payloads line-by-line."""
      for subpart in msg.walk():
          payload = subpart.get_payload()
***************
*** 21,33 ****
  
  
! def typed_subpart_iterator(msg, major='text', minor=None):
!     """Iterator over the subparts with a given MIME type.
  
!     Use `major' as the main MIME type to match against; this defaults to
!     "text".  Optional `minor' is the MIME subtype to match against; if
      omitted, only the main type is matched.
      """
      for subpart in msg.walk():
!         if subpart.get_main_type() == major:
!             if minor is None or subpart.get_subtype() == minor:
                  yield subpart
--- 21,33 ----
  
  
! def typed_subpart_iterator(msg, maintype='text', subtype=None):
!     """Iterate over the subparts with a given MIME type.
  
!     Use `maintype' as the main MIME type to match against; this defaults to
!     "text".  Optional `subtype' is the MIME subtype to match against; if
      omitted, only the main type is matched.
      """
      for subpart in msg.walk():
!         if subpart.get_main_type() == maintype:
!             if subtype is None or subpart.get_subtype() == subtype:
                  yield subpart