@@ -32,16 +32,16 @@ class Generator:
3232 # Public interface
3333 #
3434
35- def __init__ (self , outfp , mangle_from_ = True , maxheaderlen = None , * ,
35+ def __init__ (self , outfp , mangle_from_ = None , maxheaderlen = None , * ,
3636 policy = None ):
3737 """Create the generator for message flattening.
3838
3939 outfp is the output file-like object for writing the message to. It
4040 must have a write() method.
4141
42- Optional mangle_from_ is a flag that, when True (the default), escapes
43- From_ lines in the body of the message by putting a `>' in front of
44- them.
42+ Optional mangle_from_ is a flag that, when True (the default if policy
43+ is not set), escapes From_ lines in the body of the message by putting
44+ a `>' in front of them.
4545
4646 Optional maxheaderlen specifies the longest length for a non-continued
4747 header. When a header line is longer (in characters, with tabs
@@ -56,6 +56,9 @@ def __init__(self, outfp, mangle_from_=True, maxheaderlen=None, *,
5656 flatten method is used.
5757
5858 """
59+
60+ if mangle_from_ is None :
61+ mangle_from_ = True if policy is None else policy .mangle_from_
5962 self ._fp = outfp
6063 self ._mangle_from_ = mangle_from_
6164 self .maxheaderlen = maxheaderlen
@@ -449,7 +452,7 @@ class DecodedGenerator(Generator):
449452 Like the Generator base class, except that non-text parts are substituted
450453 with a format string representing the part.
451454 """
452- def __init__ (self , outfp , mangle_from_ = True , maxheaderlen = 78 , fmt = None ):
455+ def __init__ (self , outfp , mangle_from_ = None , maxheaderlen = 78 , fmt = None ):
453456 """Like Generator.__init__() except that an additional optional
454457 argument is allowed.
455458
0 commit comments