mirror of
https://github.com/python/cpython.git
synced 2025-11-03 07:01:21 +00:00
append(): Bite the bullet and let charset be the string name of a
character set, which we'll convert to a Charset instance. Sigh.
This commit is contained in:
parent
15d3739446
commit
92825a9a52
1 changed files with 6 additions and 3 deletions
|
|
@ -188,12 +188,15 @@ def __ne__(self, other):
|
||||||
def append(self, s, charset=None):
|
def append(self, s, charset=None):
|
||||||
"""Append string s with Charset charset to the MIME header.
|
"""Append string s with Charset charset to the MIME header.
|
||||||
|
|
||||||
charset defaults to the one given in the class constructor. If
|
If charset is given, it should be a Charset instance, or the name of a
|
||||||
charset is given, it should be an instance of Charset (not a character
|
character set (which will be converted to a Charset instance). A
|
||||||
set name string!).
|
value of None (the default) means charset is the one given in the
|
||||||
|
class constructor.
|
||||||
"""
|
"""
|
||||||
if charset is None:
|
if charset is None:
|
||||||
charset = self._charset
|
charset = self._charset
|
||||||
|
elif not isinstance(charset, Charset):
|
||||||
|
charset = Charset(charset)
|
||||||
self._chunks.append((s, charset))
|
self._chunks.append((s, charset))
|
||||||
|
|
||||||
def _split(self, s, charset, firstline=0):
|
def _split(self, s, charset, firstline=0):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue