summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2011-03-15 21:41:13 (GMT)
committerR David Murray <rdmurray@bitdance.com>2011-03-15 21:41:13 (GMT)
commite3d09ff269330bd0076e3ab9cb81907fad717a68 (patch)
treeb33566cb524ed8917cc55013f046f88479264a40
parent126848a2d8e7b22401d9883549005d6b46339d91 (diff)
downloadcpython-e3d09ff269330bd0076e3ab9cb81907fad717a68.zip
cpython-e3d09ff269330bd0076e3ab9cb81907fad717a68.tar.gz
cpython-e3d09ff269330bd0076e3ab9cb81907fad717a68.tar.bz2
#11216: document all possible set_charset execution paths.
-rw-r--r--Doc/library/email.message.rst25
1 files changed, 16 insertions, 9 deletions
diff --git a/Doc/library/email.message.rst b/Doc/library/email.message.rst
index d1a12c5..4b23f6a 100644
--- a/Doc/library/email.message.rst
+++ b/Doc/library/email.message.rst
@@ -130,15 +130,22 @@ Here are the methods of the :class:`Message` class:
string naming a character set, or ``None``. If it is a string, it will
be converted to a :class:`~email.charset.Charset` instance. If *charset*
is ``None``, the ``charset`` parameter will be removed from the
- :mailheader:`Content-Type` header. Anything else will generate a
- :exc:`TypeError`.
-
- The message will be assumed to be of type :mimetype:`text/\*` encoded with
- *charset.input_charset*. It will be converted to *charset.output_charset*
- and encoded properly, if needed, when generating the plain text
- representation of the message. MIME headers (:mailheader:`MIME-Version`,
- :mailheader:`Content-Type`, :mailheader:`Content-Transfer-Encoding`) will
- be added as needed.
+ :mailheader:`Content-Type` header (the message will not be otherwise
+ modified). Anything else will generate a :exc:`TypeError`.
+
+ If there is no existing :mailheader:`MIME-Version` header one will be
+ added. If there is no existing :mailheader:`Content-Type` header, one
+ will be added with a value of :mimetype:`text/plain`. Whether the
+ :mailheader:`Content-Type` header already exists or not, its ``charset``
+ parameter will be set to *charset.output_charset*. If
+ *charset.input_charset* and *charset.output_charset* differ, the payload
+ will be re-encoded to the *output_charset*. If there is no existing
+ :mailheader:`Content-Transfer-Encoding` header, then the payload will be
+ transfer-encoded, if needed, using the specified
+ :class:`~email.charset.Charset`, and a header with the appropriate value
+ will be added. If a :mailheader:`Content-Transfer-Encoding` header
+ already exists, the payload is assumed to already be correctly encoded
+ using that :mailheader:`Content-Transfer-Encoding` and is not modified.
.. method:: get_charset()