diff options
author | Barry Warsaw <barry@python.org> | 2002-07-23 06:08:10 (GMT) |
---|---|---|
committer | Barry Warsaw <barry@python.org> | 2002-07-23 06:08:10 (GMT) |
commit | 92825a9a525c268b9797b8be28dbd959b64a821d (patch) | |
tree | b04004a87961f6897072675830394fcabfd03d8c | |
parent | 15d3739446661b11e4caeb960a1903af5ba7e7dc (diff) | |
download | cpython-92825a9a525c268b9797b8be28dbd959b64a821d.zip cpython-92825a9a525c268b9797b8be28dbd959b64a821d.tar.gz cpython-92825a9a525c268b9797b8be28dbd959b64a821d.tar.bz2 |
append(): Bite the bullet and let charset be the string name of a
character set, which we'll convert to a Charset instance. Sigh.
-rw-r--r-- | Lib/email/Header.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/email/Header.py b/Lib/email/Header.py index e691c3c..2457279 100644 --- a/Lib/email/Header.py +++ b/Lib/email/Header.py @@ -188,12 +188,15 @@ class Header: def append(self, s, charset=None): """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 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)) def _split(self, s, charset, firstline=0): |