summaryrefslogtreecommitdiffstats
path: root/Doc/library/email.header.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/email.header.rst')
-rw-r--r--Doc/library/email.header.rst75
1 files changed, 38 insertions, 37 deletions
diff --git a/Doc/library/email.header.rst b/Doc/library/email.header.rst
index ecd9f1f..5f37264 100644
--- a/Doc/library/email.header.rst
+++ b/Doc/library/email.header.rst
@@ -74,65 +74,66 @@ Here is the :class:`Header` class description:
and is usually either a space or a hard tab character. This character will be
prepended to continuation lines.
-Optional *errors* is passed straight through to the :meth:`append` method.
+ Optional *errors* is passed straight through to the :meth:`append` method.
-.. method:: Header.append(s[, charset[, errors]])
+ .. method:: append(s[, charset[, errors]])
- Append the string *s* to the MIME header.
+ Append the string *s* to the MIME header.
- Optional *charset*, if given, should be a :class:`Charset` instance (see
- :mod:`email.charset`) or the name of a character set, which will be converted to
- a :class:`Charset` instance. A value of ``None`` (the default) means that the
- *charset* given in the constructor is used.
+ Optional *charset*, if given, should be a :class:`Charset` instance (see
+ :mod:`email.charset`) or the name of a character set, which will be
+ converted to a :class:`Charset` instance. A value of ``None`` (the
+ default) means that the *charset* given in the constructor is used.
- *s* may be an instance of :class:`bytes` or :class:`str`. If it is an instance
- of :class:`bytes`, then *charset* is the encoding of that byte string, and a
- :exc:`UnicodeError` will be raised if the string cannot be decoded with that
- character set.
+ *s* may be an instance of :class:`bytes` or :class:`str`. If it is an
+ instance of :class:`bytes`, then *charset* is the encoding of that byte
+ string, and a :exc:`UnicodeError` will be raised if the string cannot be
+ decoded with that character set.
- If *s* is an instance of :class:`str`, then *charset* is a hint specifying the
- character set of the characters in the string. In this case, when producing an
- :rfc:`2822`\ -compliant header using :rfc:`2047` rules, the Unicode string will
- be encoded using the following charsets in order: ``us-ascii``, the *charset*
- hint, ``utf-8``. The first character set to not provoke a :exc:`UnicodeError`
- is used.
+ If *s* is an instance of :class:`str`, then *charset* is a hint specifying
+ the character set of the characters in the string. In this case, when
+ producing an :rfc:`2822`\ -compliant header using :rfc:`2047` rules, the
+ Unicode string will be encoded using the following charsets in order:
+ ``us-ascii``, the *charset* hint, ``utf-8``. The first character set to
+ not provoke a :exc:`UnicodeError` is used.
- Optional *errors* is passed through to any :func:`encode` or
- :func:`ustr.encode` call, and defaults to "strict".
+ Optional *errors* is passed through to any :func:`encode` or
+ :func:`ustr.encode` call, and defaults to "strict".
-.. method:: Header.encode([splitchars])
+ .. method:: encode([splitchars])
- Encode a message header into an RFC-compliant format, possibly wrapping long
- lines and encapsulating non-ASCII parts in base64 or quoted-printable encodings.
- Optional *splitchars* is a string containing characters to split long ASCII
- lines on, in rough support of :rfc:`2822`'s *highest level syntactic breaks*.
- This doesn't affect :rfc:`2047` encoded lines.
+ Encode a message header into an RFC-compliant format, possibly wrapping
+ long lines and encapsulating non-ASCII parts in base64 or quoted-printable
+ encodings. Optional *splitchars* is a string containing characters to
+ split long ASCII lines on, in rough support of :rfc:`2822`'s *highest
+ level syntactic breaks*. This doesn't affect :rfc:`2047` encoded lines.
-The :class:`Header` class also provides a number of methods to support standard
-operators and built-in functions.
+ The :class:`Header` class also provides a number of methods to support
+ standard operators and built-in functions.
-.. method:: Header.__str__()
+ .. method:: __str__()
- A synonym for :meth:`Header.encode`. Useful for ``str(aHeader)``.
+ A synonym for :meth:`Header.encode`. Useful for ``str(aHeader)``.
-.. method:: Header.__unicode__()
+ .. method:: __unicode__()
- A helper for :class:`str`'s :func:`encode` method. Returns the header as a
- Unicode string.
+ A helper for :class:`str`'s :func:`encode` method. Returns the header as
+ a Unicode string.
+ .. method:: __eq__(other)
-.. method:: Header.__eq__(other)
+ This method allows you to compare two :class:`Header` instances for
+ equality.
- This method allows you to compare two :class:`Header` instances for equality.
+ .. method:: __ne__(other)
-.. method:: Header.__ne__(other)
-
- This method allows you to compare two :class:`Header` instances for inequality.
+ This method allows you to compare two :class:`Header` instances for
+ inequality.
The :mod:`email.header` module also provides the following convenient functions.