MCPcopy
hub / github.com/django/django / as_bytes

Method as_bytes

django/core/mail/message.py:177–188  ·  view source on GitHub ↗

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")

Source from the content-addressed store, hash-verified

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.

Callers 15

write_messageMethod · 0.80
_sendMethod · 0.80
write_messageMethod · 0.80
get_raw_attachmentsMethod · 0.80
test_unicode_headersMethod · 0.80
test_encodingMethod · 0.80

Calls 2

flattenMethod · 0.45
getvalueMethod · 0.45