Skip to content

Commit 301edfa

Browse files
committed
Add policy keyword to email.generator.DecodedGenerator.
1 parent 4c483ad commit 301edfa

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

Doc/library/email.generator.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ except that non-\ :mimetype:`text` parts are not serialized, but are instead
234234
represented in the output stream by a string derived from a template filled
235235
in with information about the part.
236236

237-
.. class:: DecodedGenerator(outfp, mangle_from_=None, maxheaderlen=78, fmt=None)
237+
.. class:: DecodedGenerator(outfp, mangle_from_=None, maxheaderlen=None, \
238+
fmt=None, *, policy=None)
238239
239240
Act like :class:`Generator`, except that for any subpart of the message
240241
passed to :meth:`Generator.flatten`, if the subpart is of main type
@@ -263,8 +264,7 @@ in with information about the part.
263264
"[Non-text (%(type)s) part of message omitted, filename %(filename)s]"
264265

265266
Optional *_mangle_from_* and *maxheaderlen* are as with the
266-
:class:`Generator` base class, except that the default value for
267-
*maxheaderlen* is ``78`` (the RFC standard default header length).
267+
:class:`Generator` base class.
268268

269269

270270
.. rubric:: Footnotes

Doc/whatsnew/3.6.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -531,13 +531,17 @@ the legacy API. (Contributed by R. David Murray in :issue:`24277`.)
531531
The :mod:`email.mime` classes now all accept an optional *policy* keyword.
532532
(Contributed by Berker Peksag in :issue:`27331`.)
533533

534+
The :class:`~email.generator.DecodedGenerator` now supports the *policy*
535+
keyword.
536+
534537

535538
encodings
536539
---------
537540

538541
On Windows, added the ``'oem'`` encoding to use ``CP_OEMCP`` and the ``'ansi'``
539542
alias for the existing ``'mbcs'`` encoding, which uses the ``CP_ACP`` code page.
540543

544+
541545
faulthandler
542546
------------
543547

Lib/email/generator.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,8 @@ class DecodedGenerator(Generator):
452452
Like the Generator base class, except that non-text parts are substituted
453453
with a format string representing the part.
454454
"""
455-
def __init__(self, outfp, mangle_from_=None, maxheaderlen=78, fmt=None):
455+
def __init__(self, outfp, mangle_from_=None, maxheaderlen=None, fmt=None, *,
456+
policy=None):
456457
"""Like Generator.__init__() except that an additional optional
457458
argument is allowed.
458459
@@ -474,7 +475,8 @@ def __init__(self, outfp, mangle_from_=None, maxheaderlen=78, fmt=None):
474475
475476
[Non-text (%(type)s) part of message omitted, filename %(filename)s]
476477
"""
477-
Generator.__init__(self, outfp, mangle_from_, maxheaderlen)
478+
Generator.__init__(self, outfp, mangle_from_, maxheaderlen,
479+
policy=policy)
478480
if fmt is None:
479481
self._fmt = _FMT
480482
else:

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ Core and Builtins
103103
Library
104104
-------
105105

106+
- email.generator.DecodedGenerator now supports the policy keyword.
107+
106108
- Issue #28027: Remove undocumented modules from ``Lib/plat-*``: IN, CDROM,
107109
DLFCN, TYPES, CDIO, and STROPTS.
108110

0 commit comments

Comments
 (0)