[Python-checkins] python/dist/src/Lib/email Header.py,1.9,1.10

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
Mon, 22 Jul 2002 23:08:13 -0700


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

Modified Files:
	Header.py 
Log Message:
append(): Bite the bullet and let charset be the string name of a
character set, which we'll convert to a Charset instance.  Sigh.


Index: Header.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/email/Header.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Header.py	23 Jul 2002 04:29:54 -0000	1.9
--- Header.py	23 Jul 2002 06:08:10 -0000	1.10
***************
*** 189,198 ****
          """Append string s with Charset charset to the MIME header.
  
!         charset defaults to the one given in the class constructor.  If
!         charset is given, it should be an instance of Charset (not a character
!         set name string!).
          """
          if charset is None:
              charset = self._charset
          self._chunks.append((s, charset))
  
--- 189,201 ----
          """Append string s with Charset charset to the MIME header.
  
!         If charset is given, it should be a Charset instance, or the name of a
!         character set (which will be converted to a Charset instance).  A
!         value of None (the default) means charset is the one given in the
!         class constructor.
          """
          if charset is None:
              charset = self._charset
+         elif not isinstance(charset, Charset):
+             charset = Charset(charset)
          self._chunks.append((s, charset))