From f03c95da9bbd7bbd8fad9e103707c900ce9d8414 Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Mon, 20 Aug 2018 16:58:38 +0200 Subject: [PATCH] encode buttons on "action links" emails (#25721) --- tests/test_form_pages.py | 4 ++-- wcs/qommon/emails.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/test_form_pages.py b/tests/test_form_pages.py index d5e33ca4..4e2d3674 100644 --- a/tests/test_form_pages.py +++ b/tests/test_form_pages.py @@ -4931,7 +4931,7 @@ def test_email_actions(pub, emails): # change email subjects to differentiate them workflow.possible_status[0].items[0].subject = 'New form ([name])' workflow.possible_status[0].items[1].subject = 'New form2 ([name])' - workflow.possible_status[0].items[1].body = 'Hello; {% action_button "do-accept" label="Accept!" %} Bye.' + workflow.possible_status[0].items[1].body = 'Hello; {% action_button "do-accept" label="Accepté!" %} Adiós.' workflow.possible_status[1].items[1].identifier = 'do-accept' workflow.store() @@ -4956,7 +4956,7 @@ def test_email_actions(pub, emails): app = get_app(pub) resp = app.get(action_url) - assert 'Accept!' in resp.body + assert 'Accepté!' in resp.body resp = resp.form.submit() assert 'The action has been confirmed.' in resp.body assert formdef.data_class().count() == 1 diff --git a/wcs/qommon/emails.py b/wcs/qommon/emails.py index 587c64a4..d1462572 100644 --- a/wcs/qommon/emails.py +++ b/wcs/qommon/emails.py @@ -188,7 +188,7 @@ def email(subject, mail_body, email_rcpt, replyto = None, bcc = None, 'label': match.group('label'), 'url': get_action_url(match), } - return render_to_string('qommon/email_button_link.html', context) + return render_to_string('qommon/email_button_link.html', context).encode(encoding) text_body = button_re.sub(text_button, text_body) if text_body else None html_body = button_re.sub(html_button, html_body) if html_body else None -- 2.18.0