Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/library/email.mime.rst

    r2 r391  
    1 :mod:`email`: Creating email and MIME objects from scratch
    2 ----------------------------------------------------------
     1:mod:`email.mime`: Creating email and MIME objects from scratch
     2---------------------------------------------------------------
    33
    44.. module:: email.mime
     
    3636   or :mimetype:`image`), and *_subtype* is the :mailheader:`Content-Type` minor
    3737   type  (e.g. :mimetype:`plain` or :mimetype:`gif`).  *_params* is a parameter
    38    key/value dictionary and is passed directly to :meth:`Message.add_header`.
     38   key/value dictionary and is passed directly to :meth:`Message.add_header
     39   <email.message.Message.add_header>`.
    3940
    4041   The :class:`MIMEBase` class always adds a :mailheader:`Content-Type` header
     
    5152   A subclass of :class:`~email.mime.base.MIMEBase`, this is an intermediate base
    5253   class for MIME messages that are not :mimetype:`multipart`.  The primary
    53    purpose of this class is to prevent the use of the :meth:`attach` method,
    54    which only makes sense for :mimetype:`multipart` messages.  If :meth:`attach`
     54   purpose of this class is to prevent the use of the
     55   :meth:`~email.message.Message.attach` method, which only makes sense for
     56   :mimetype:`multipart` messages.  If :meth:`~email.message.Message.attach`
    5557   is called, a :exc:`~email.errors.MultipartConversionError` exception is raised.
    5658
     
    7779   *_subparts* is a sequence of initial subparts for the payload.  It must be
    7880   possible to convert this sequence to a list.  You can always attach new subparts
    79    to the message by using the :meth:`Message.attach` method.
     81   to the message by using the :meth:`Message.attach
     82   <email.message.Message.attach>` method.
    8083
    8184   Additional parameters for the :mailheader:`Content-Type` header are taken from
     
    100103   Optional *_encoder* is a callable (i.e. function) which will perform the actual
    101104   encoding of the data for transport.  This callable takes one argument, which is
    102    the :class:`MIMEApplication` instance. It should use :meth:`get_payload` and
    103    :meth:`set_payload` to change the payload to encoded form.  It should also add
     105   the :class:`MIMEApplication` instance. It should use
     106   :meth:`~email.message.Message.get_payload` and
     107   :meth:`~email.message.Message.set_payload` to change the payload to encoded
     108   form.  It should also add
    104109   any :mailheader:`Content-Transfer-Encoding` or other headers to the message
    105110   object as necessary.  The default encoding is base64.  See the
     
    128133   Optional *_encoder* is a callable (i.e. function) which will perform the actual
    129134   encoding of the audio data for transport.  This callable takes one argument,
    130    which is the :class:`MIMEAudio` instance. It should use :meth:`get_payload` and
    131    :meth:`set_payload` to change the payload to encoded form.  It should also add
     135   which is the :class:`MIMEAudio` instance. It should use
     136   :meth:`~email.message.Message.get_payload` and
     137   :meth:`~email.message.Message.set_payload` to change the payload to encoded
     138   form.  It should also add
    132139   any :mailheader:`Content-Transfer-Encoding` or other headers to the message
    133140   object as necessary.  The default encoding is base64.  See the
     
    154161   Optional *_encoder* is a callable (i.e. function) which will perform the actual
    155162   encoding of the image data for transport.  This callable takes one argument,
    156    which is the :class:`MIMEImage` instance. It should use :meth:`get_payload` and
    157    :meth:`set_payload` to change the payload to encoded form.  It should also add
     163   which is the :class:`MIMEImage` instance. It should use
     164   :meth:`~email.message.Message.get_payload` and
     165   :meth:`~email.message.Message.set_payload` to change the payload to encoded
     166   form.  It should also add
    158167   any :mailheader:`Content-Transfer-Encoding` or other headers to the message
    159168   object as necessary.  The default encoding is base64.  See the
     
    192201   set of the text and is passed as a parameter to the
    193202   :class:`~email.mime.nonmultipart.MIMENonMultipart` constructor; it defaults
    194    to ``us-ascii``.  No guessing or encoding is performed on the text data.
     203   to ``us-ascii``.  If *_text* is unicode, it is encoded using the
     204   *output_charset* of *_charset*, otherwise it is used as-is.
    195205
    196206   .. versionchanged:: 2.4
    197       The previously deprecated *_encoding* argument has been removed.  Encoding
    198       happens implicitly based on the *_charset* argument.
    199 
     207      The previously deprecated *_encoding* argument has been removed.  Content
     208      Transfer Encoding now happens implicitly based on the *_charset*
     209      argument.
     210
     211   Unless the ``_charset`` parameter is explicitly set to ``None``, the
     212   MIMEText object created will have both a :mailheader:`Content-Type` header
     213   with a ``charset`` parameter, and a :mailheader:`Content-Transfer-Endcoding`
     214   header.  This means that a subsequent ``set_payload`` call will not result
     215   in an encoded payload, even if a charset is passed in the ``set_payload``
     216   command.  You can "reset" this behavior by deleting the
     217   ``Content-Transfer-Encoding`` header, after which a ``set_payload`` call
     218   will automatically encode the new payload (and add a new
     219   :mailheader:`Content-Transfer-Encoding` header).
Note: See TracChangeset for help on using the changeset viewer.