Ticket #19107: 19107.diff

File 19107.diff, 777 bytes (added by Claude Paroz, 12 years ago)

Workaround for python bug 1368247

  • django/core/mail/message.py

    diff --git a/django/core/mail/message.py b/django/core/mail/message.py
    index db9023a..9524bc2 100644
    a b from __future__ import unicode_literals  
    33import mimetypes
    44import os
    55import random
     6import sys
    67import time
    78from email import charset as Charset, encoders as Encoders
    89from email.generator import Generator
    class SafeMIMEText(MIMEText):  
    138139        """
    139140        fp = six.StringIO()
    140141        g = Generator(fp, mangle_from_ = False)
     142        if sys.version_info < (2, 6, 6) and isinstance(self._payload, six.text_type):
     143            self._payload = self._payload.encode(self._charset.output_charset)
    141144        g.flatten(self, unixfrom=unixfrom)
    142145        return fp.getvalue()
    143146
Back to Top