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.rst

    r2 r391  
    113113
    114114* The :mod:`email.mime.application` module was added, which contains the
    115   :class:`MIMEApplication` class.
     115  :class:`~email.mime.application.MIMEApplication` class.
    116116
    117117* Methods that were deprecated in version 3 have been removed.  These include
     
    120120
    121121* Fixes have been added for :rfc:`2231` support which can change some of the
    122   return types for :func:`Message.get_param` and friends.  Under some
     122  return types for :func:`Message.get_param <email.message.Message.get_param>`
     123  and friends.  Under some
    123124  circumstances, values which used to return a 3-tuple now return simple strings
    124125  (specifically, if all extended parameter segments were unencoded, there is no
     
    129130Here are the major differences between :mod:`email` version 3 and version 2:
    130131
    131 * The :class:`FeedParser` class was introduced, and the :class:`Parser` class
    132   was implemented in terms of the :class:`FeedParser`.  All parsing therefore is
     132* The :class:`~email.parser.FeedParser` class was introduced, and the
     133  :class:`~email.parser.Parser` class was implemented in terms of the
     134  :class:`~email.parser.FeedParser`.  All parsing therefore is
    133135  non-strict, and parsing will make a best effort never to raise an exception.
    134136  Problems found while parsing messages are stored in the message's *defect*
     
    137139* All aspects of the API which raised :exc:`DeprecationWarning`\ s in version 2
    138140  have been removed.  These include the *_encoder* argument to the
    139   :class:`MIMEText` constructor, the :meth:`Message.add_payload` method, the
    140   :func:`Utils.dump_address_pair` function, and the functions :func:`Utils.decode`
    141   and :func:`Utils.encode`.
     141  :class:`~email.mime.text.MIMEText` constructor, the
     142  :meth:`Message.add_payload` method, the :func:`Utils.dump_address_pair`
     143  function, and the functions :func:`Utils.decode` and :func:`Utils.encode`.
    142144
    143145* New :exc:`DeprecationWarning`\ s have been added to:
    144146  :meth:`Generator.__call__`, :meth:`Message.get_type`,
    145147  :meth:`Message.get_main_type`, :meth:`Message.get_subtype`, and the *strict*
    146   argument to the :class:`Parser` class.  These are expected to be removed in
    147   future versions.
     148  argument to the :class:`~email.parser.Parser` class.  These are expected to
     149  be removed in future versions.
    148150
    149151* Support for Pythons earlier than 2.3 has been removed.
     
    153155* The :mod:`email.Header` and :mod:`email.Charset` modules have been added.
    154156
    155 * The pickle format for :class:`Message` instances has changed. Since this was
    156   never (and still isn't) formally defined, this isn't considered a backward
    157   incompatibility.  However if your application pickles and unpickles
    158   :class:`Message` instances, be aware that in :mod:`email` version 2,
    159   :class:`Message` instances now have private variables *_charset* and
    160   *_default_type*.
    161 
    162 * Several methods in the :class:`Message` class have been deprecated, or their
    163   signatures changed.  Also, many new methods have been added.  See the
    164   documentation for the :class:`Message` class for details.  The changes should be
    165   completely backward compatible.
     157* The pickle format for :class:`~email.message.Message` instances has changed.
     158  Since this was never (and still isn't) formally defined, this isn't
     159  considered a backward incompatibility.  However if your application pickles
     160  and unpickles :class:`~email.message.Message` instances, be aware that in
     161  :mod:`email` version 2, :class:`~email.message.Message` instances now have
     162  private variables *_charset* and *_default_type*.
     163
     164* Several methods in the :class:`~email.message.Message` class have been
     165  deprecated, or their signatures changed.  Also, many new methods have been
     166  added.  See the documentation for the :class:`~email.message.Message` class
     167  for details.  The changes should be completely backward compatible.
    166168
    167169* The object structure has changed in the face of :mimetype:`message/rfc822`
    168   content types.  In :mod:`email` version 1, such a type would be represented by a
    169   scalar payload, i.e. the container message's :meth:`is_multipart` returned
    170   false, :meth:`get_payload` was not a list object, but a single :class:`Message`
    171   instance.
     170  content types.  In :mod:`email` version 1, such a type would be represented
     171  by a scalar payload, i.e. the container message's
     172  :meth:`~email.message.Message.is_multipart` returned false,
     173  :meth:`~email.message.Message.get_payload` was not a list object, but a
     174  single :class:`~email.message.Message` instance.
    172175
    173176  This structure was inconsistent with the rest of the package, so the object
    174177  representation for :mimetype:`message/rfc822` content types was changed.  In
    175178  :mod:`email` version 2, the container *does* return ``True`` from
    176   :meth:`is_multipart`, and :meth:`get_payload` returns a list containing a single
    177   :class:`Message` item.
    178 
    179   Note that this is one place that backward compatibility could not be completely
    180   maintained.  However, if you're already testing the return type of
    181   :meth:`get_payload`, you should be fine.  You just need to make sure your code
    182   doesn't do a :meth:`set_payload` with a :class:`Message` instance on a container
    183   with a content type of :mimetype:`message/rfc822`.
    184 
    185 * The :class:`Parser` constructor's *strict* argument was added, and its
    186   :meth:`parse` and :meth:`parsestr` methods grew a *headersonly* argument.  The
    187   *strict* flag was also added to functions :func:`email.message_from_file` and
    188   :func:`email.message_from_string`.
    189 
    190 * :meth:`Generator.__call__` is deprecated; use :meth:`Generator.flatten`
    191   instead.  The :class:`Generator` class has also grown the :meth:`clone` method.
    192 
    193 * The :class:`DecodedGenerator` class in the :mod:`email.Generator` module was
    194   added.
    195 
    196 * The intermediate base classes :class:`MIMENonMultipart` and
    197   :class:`MIMEMultipart` have been added, and interposed in the class hierarchy
    198   for most of the other MIME-related derived classes.
    199 
    200 * The *_encoder* argument to the :class:`MIMEText` constructor has been
    201   deprecated.  Encoding  now happens implicitly based on the *_charset* argument.
     179  :meth:`~email.message.Message.is_multipart`, and
     180  :meth:`~email.message.Message.get_payload` returns a list containing a single
     181  :class:`~email.message.Message` item.
     182
     183  Note that this is one place that backward compatibility could not be
     184  completely maintained.  However, if you're already testing the return type of
     185  :meth:`~email.message.Message.get_payload`, you should be fine.  You just need
     186  to make sure your code doesn't do a :meth:`~email.message.Message.set_payload`
     187  with a :class:`~email.message.Message` instance on a container with a content
     188  type of :mimetype:`message/rfc822`.
     189
     190* The :class:`~email.parser.Parser` constructor's *strict* argument was added,
     191  and its :meth:`~email.parser.Parser.parse` and
     192  :meth:`~email.parser.Parser.parsestr` methods grew a *headersonly* argument.
     193  The *strict* flag was also added to functions :func:`email.message_from_file`
     194  and :func:`email.message_from_string`.
     195
     196* :meth:`Generator.__call__` is deprecated; use :meth:`Generator.flatten
     197  <email.generator.Generator.flatten>` instead.  The
     198  :class:`~email.generator.Generator` class has also grown the
     199  :meth:`~email.generator.Generator.clone` method.
     200
     201* The :class:`~email.generator.DecodedGenerator` class in the
     202  :mod:`email.generator` module was added.
     203
     204* The intermediate base classes
     205  :class:`~email.mime.nonmultipart.MIMENonMultipart` and
     206  :class:`~email.mime.multipart.MIMEMultipart` have been added, and interposed
     207  in the class hierarchy for most of the other MIME-related derived classes.
     208
     209* The *_encoder* argument to the :class:`~email.mime.text.MIMEText` constructor
     210  has been deprecated.  Encoding  now happens implicitly based on the
     211  *_charset* argument.
    202212
    203213* The following functions in the :mod:`email.Utils` module have been deprecated:
     
    232242* :func:`messageFromFile` has been renamed to :func:`message_from_file`.
    233243
    234 The :class:`Message` class has the following differences:
    235 
    236 * The method :meth:`asString` was renamed to :meth:`as_string`.
    237 
    238 * The method :meth:`ismultipart` was renamed to :meth:`is_multipart`.
    239 
    240 * The :meth:`get_payload` method has grown a *decode* optional argument.
    241 
    242 * The method :meth:`getall` was renamed to :meth:`get_all`.
    243 
    244 * The method :meth:`addheader` was renamed to :meth:`add_header`.
     244The :class:`~email.message.Message` class has the following differences:
     245
     246* The method :meth:`asString` was renamed to
     247  :meth:`~email.message.Message.as_string`.
     248
     249* The method :meth:`ismultipart` was renamed to
     250  :meth:`~email.message.Message.is_multipart`.
     251
     252* The :meth:`~email.message.Message.get_payload` method has grown a *decode*
     253  optional argument.
     254
     255* The method :meth:`getall` was renamed to
     256  :meth:`~email.message.Message.get_all`.
     257
     258* The method :meth:`addheader` was renamed to
     259  :meth:`~email.message.Message.add_header`.
    245260
    246261* The method :meth:`gettype` was renamed to :meth:`get_type`.
     
    250265* The method :meth:`getsubtype` was renamed to :meth:`get_subtype`.
    251266
    252 * The method :meth:`getparams` was renamed to :meth:`get_params`. Also, whereas
    253   :meth:`getparams` returned a list of strings, :meth:`get_params` returns a list
    254   of 2-tuples, effectively the key/value pairs of the parameters, split on the
    255   ``'='`` sign.
    256 
    257 * The method :meth:`getparam` was renamed to :meth:`get_param`.
    258 
    259 * The method :meth:`getcharsets` was renamed to :meth:`get_charsets`.
    260 
    261 * The method :meth:`getfilename` was renamed to :meth:`get_filename`.
    262 
    263 * The method :meth:`getboundary` was renamed to :meth:`get_boundary`.
    264 
    265 * The method :meth:`setboundary` was renamed to :meth:`set_boundary`.
     267* The method :meth:`getparams` was renamed to
     268  :meth:`~email.message.Message.get_params`. Also, whereas :meth:`getparams`
     269  returned a list of strings, :meth:`~email.message.Message.get_params` returns
     270  a list of 2-tuples, effectively the key/value pairs of the parameters, split
     271  on the ``'='`` sign.
     272
     273* The method :meth:`getparam` was renamed to
     274  :meth:`~email.message.Message.get_param`.
     275
     276* The method :meth:`getcharsets` was renamed to
     277  :meth:`~email.message.Message.get_charsets`.
     278
     279* The method :meth:`getfilename` was renamed to
     280  :meth:`~email.message.Message.get_filename`.
     281
     282* The method :meth:`getboundary` was renamed to
     283  :meth:`~email.message.Message.get_boundary`.
     284
     285* The method :meth:`setboundary` was renamed to
     286  :meth:`~email.message.Message.set_boundary`.
    266287
    267288* The method :meth:`getdecodedpayload` was removed.  To get similar
    268   functionality, pass the value 1 to the *decode* flag of the get_payload()
    269   method.
     289  functionality, pass the value 1 to the *decode* flag of the
     290  :meth:`~email.message.Message.get_payload` method.
    270291
    271292* The method :meth:`getpayloadastext` was removed.  Similar functionality is
    272   supported by the :class:`DecodedGenerator` class in the :mod:`email.generator`
     293  supported by the :class:`~email.generator.DecodedGenerator` class in the
     294  :mod:`email.generator` module.
     295
     296* The method :meth:`getbodyastext` was removed.  You can get similar
     297  functionality by creating an iterator with
     298  :func:`~email.iterators.typed_subpart_iterator` in the :mod:`email.iterators`
    273299  module.
    274300
    275 * The method :meth:`getbodyastext` was removed.  You can get similar
    276   functionality by creating an iterator with :func:`typed_subpart_iterator` in the
    277   :mod:`email.iterators` module.
    278 
    279 The :class:`Parser` class has no differences in its public interface. It does
    280 have some additional smarts to recognize :mimetype:`message/delivery-status`
    281 type messages, which it represents as a :class:`Message` instance containing
    282 separate :class:`Message` subparts for each header block in the delivery status
    283 notification [#]_.
    284 
    285 The :class:`Generator` class has no differences in its public interface.  There
    286 is a new class in the :mod:`email.generator` module though, called
    287 :class:`DecodedGenerator` which provides most of the functionality previously
    288 available in the :meth:`Message.getpayloadastext` method.
     301The :class:`~email.parser.Parser` class has no differences in its public
     302interface. It does have some additional smarts to recognize
     303:mimetype:`message/delivery-status` type messages, which it represents as a
     304:class:`~email.message.Message` instance containing separate
     305:class:`~email.message.Message` subparts for each header block in the delivery
     306status notification [#]_.
     307
     308The :class:`~email.generator.Generator` class has no differences in its public
     309interface.  There is a new class in the :mod:`email.generator` module though,
     310called :class:`~email.generator.DecodedGenerator` which provides most of the
     311functionality previously available in the :meth:`Message.getpayloadastext`
     312method.
    289313
    290314The following modules and classes have been changed:
    291315
    292 * The :class:`MIMEBase` class constructor arguments *_major* and *_minor* have
    293   changed to *_maintype* and *_subtype* respectively.
     316* The :class:`~email.mime.base.MIMEBase` class constructor arguments *_major*
     317  and *_minor* have changed to *_maintype* and *_subtype* respectively.
    294318
    295319* The ``Image`` class/module has been renamed to ``MIMEImage``.  The *_minor*
     
    304328  case-insensitive file systems.
    305329
    306   Also, the :class:`MIMEMessage` class now represents any kind of MIME message
     330  Also, the :class:`~email.mime.message.MIMEMessage` class now represents any
     331  kind of MIME message
    307332  with main type :mimetype:`message`.  It takes an optional argument *_subtype*
    308333  which is used to set the MIME subtype.  *_subtype* defaults to
     
    314339
    315340The ``MsgReader`` class/module has been removed.  Its functionality is most
    316 closely supported in the :func:`body_line_iterator` function in the
    317 :mod:`email.iterators` module.
     341closely supported in the :func:`~email.iterators.body_line_iterator` function
     342in the :mod:`email.iterators` module.
    318343
    319344.. rubric:: Footnotes
Note: See TracChangeset for help on using the changeset viewer.