]> granicus.if.org Git - python/commitdiff
Add policy keyword to email.generator.DecodedGenerator.
authorR David Murray <rdmurray@bitdance.com>
Thu, 8 Sep 2016 21:57:06 +0000 (17:57 -0400)
committerR David Murray <rdmurray@bitdance.com>
Thu, 8 Sep 2016 21:57:06 +0000 (17:57 -0400)
Doc/library/email.generator.rst
Doc/whatsnew/3.6.rst
Lib/email/generator.py
Misc/NEWS

index c1d94caa287a0724021e47efef8c734cfe02763c..ab0fbc29d1ec8569cc689c0639b38497f97a3e53 100644 (file)
@@ -234,7 +234,8 @@ except that non-\ :mimetype:`text` parts are not serialized, but are instead
 represented in the output stream by a string derived from a template filled
 in with information about the part.
 
-.. class:: DecodedGenerator(outfp, mangle_from_=None, maxheaderlen=78, fmt=None)
+.. class:: DecodedGenerator(outfp, mangle_from_=None, maxheaderlen=None, \
+                            fmt=None, *, policy=None)
 
    Act like :class:`Generator`, except that for any subpart of the message
    passed to :meth:`Generator.flatten`, if the subpart is of main type
@@ -263,8 +264,7 @@ in with information about the part.
       "[Non-text (%(type)s) part of message omitted, filename %(filename)s]"
 
    Optional *_mangle_from_* and *maxheaderlen* are as with the
-   :class:`Generator` base class, except that the default value for
-   *maxheaderlen* is ``78`` (the RFC standard default header length).
+   :class:`Generator` base class.
 
 
 .. rubric:: Footnotes
index fa3886cffef012bedc6643fb9fc4402680afa7eb..23b8a32bb07d0636b90bf24f66995a4a7b5ccaa4 100644 (file)
@@ -531,6 +531,9 @@ the legacy API.  (Contributed by R. David Murray in :issue:`24277`.)
 The :mod:`email.mime` classes now all accept an optional *policy* keyword.
 (Contributed by Berker Peksag in :issue:`27331`.)
 
+The :class:`~email.generator.DecodedGenerator` now supports the *policy*
+keyword.
+
 
 encodings
 ---------
@@ -538,6 +541,7 @@ encodings
 On Windows, added the ``'oem'`` encoding to use ``CP_OEMCP`` and the ``'ansi'``
 alias for the existing ``'mbcs'`` encoding, which uses the ``CP_ACP`` code page.
 
+
 faulthandler
 ------------
 
index 7c3cdc96d52dd552f1e6bc2ab857e03e6cd24522..ae42cdfe22fd741d9cf7bab6aef70260996b5cce 100644 (file)
@@ -452,7 +452,8 @@ class DecodedGenerator(Generator):
     Like the Generator base class, except that non-text parts are substituted
     with a format string representing the part.
     """
-    def __init__(self, outfp, mangle_from_=None, maxheaderlen=78, fmt=None):
+    def __init__(self, outfp, mangle_from_=None, maxheaderlen=None, fmt=None, *,
+                 policy=None):
         """Like Generator.__init__() except that an additional optional
         argument is allowed.
 
@@ -474,7 +475,8 @@ class DecodedGenerator(Generator):
 
         [Non-text (%(type)s) part of message omitted, filename %(filename)s]
         """
-        Generator.__init__(self, outfp, mangle_from_, maxheaderlen)
+        Generator.__init__(self, outfp, mangle_from_, maxheaderlen,
+                           policy=policy)
         if fmt is None:
             self._fmt = _FMT
         else:
index c9ba8eca47e288f8965ce1b4c0010fe16804afff..9e341e8c58ec0915c4c9896fcb2538db7b7fd76c 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -103,6 +103,8 @@ Core and Builtins
 Library
 -------
 
+- email.generator.DecodedGenerator now supports the policy keyword.
+
 - Issue #28027: Remove undocumented modules from ``Lib/plat-*``: IN, CDROM,
   DLFCN, TYPES, CDIO, and STROPTS.