MCPcopy
hub / github.com/django/django / set_payload

Method set_payload

django/core/mail/message.py:210–220  ·  view source on GitHub ↗
(self, payload, charset=None)

Source from the content-addressed store, hash-verified

208 MIMEText.__setitem__(self, name, val)
209
210 def set_payload(self, payload, charset=None):
211 if charset == "utf-8" and not isinstance(charset, Charset.Charset):
212 has_long_lines = any(
213 len(line.encode(errors="surrogateescape"))
214 > RFC5322_EMAIL_LINE_LENGTH_LIMIT
215 for line in payload.splitlines()
216 )
217 # Quoted-Printable encoding has the side effect of shortening long
218 # lines, if any (#22561).
219 charset = utf8_charset_qp if has_long_lines else utf8_charset
220 MIMEText.set_payload(self, payload, charset=charset)
221
222
223# RemovedInDjango70Warning.

Callers 1

Calls 1

encodeMethod · 0.45

Tested by 1