emails: force_str() on html rendition of email (#36515)

This commit is contained in:
Frédéric Péters 2019-11-16 18:36:50 +01:00
parent 3145fd7367
commit 2877790b24
1 changed files with 2 additions and 1 deletions

View File

@ -46,6 +46,7 @@ from django.utils.six import StringIO
from quixote import get_request, get_response, get_publisher
from .publisher import get_cfg, get_logger
from . import force_str
from . import errors
from . import tokens
from .admin.emails import EmailsDirectory
@ -182,7 +183,7 @@ def email(subject, mail_body, email_rcpt, replyto=None, bcc=None,
config_section = None,
enable_exit_status = None)
# change paragraphs so manual newlines are considered.
htmlmail = htmlmail.replace('<p>', '<p style="white-space: pre-line;">')
htmlmail = force_str(htmlmail).replace('<p>', '<p style="white-space: pre-line;">')
except:
htmlmail = None