Return the entire formatted message as bytes. Optional `unixfrom' when True, means include the Unix From_ envelope header. This overrides the default as_bytes() implementation to not mangle lines that begin with 'From '. See bug #13433 for details.
(self, unixfrom=False, linesep="\n")
| 175 | return fp.getvalue() |
| 176 | |
| 177 | def as_bytes(self, unixfrom=False, linesep="\n"): |
| 178 | """Return the entire formatted message as bytes. |
| 179 | Optional `unixfrom' when True, means include the Unix From_ envelope |
| 180 | header. |
| 181 | |
| 182 | This overrides the default as_bytes() implementation to not mangle |
| 183 | lines that begin with 'From '. See bug #13433 for details. |
| 184 | """ |
| 185 | fp = BytesIO() |
| 186 | g = generator.BytesGenerator(fp, mangle_from_=False) |
| 187 | g.flatten(self, unixfrom=unixfrom, linesep=linesep) |
| 188 | return fp.getvalue() |
| 189 | |
| 190 | |
| 191 | # RemovedInDjango70Warning. |