From 521d4efd04e758082d945c32e9c52674e01e3d9e Mon Sep 17 00:00:00 2001 From: Thomas NOEL Date: Thu, 8 Nov 2018 12:08:41 +0100 Subject: [PATCH] allow multiple "action links" by line (#27853) --- tests/test_form_pages.py | 12 ++++++++++++ wcs/qommon/emails.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/test_form_pages.py b/tests/test_form_pages.py index 7fc5fa15..5cc94010 100644 --- a/tests/test_form_pages.py +++ b/tests/test_form_pages.py @@ -5127,6 +5127,18 @@ def test_email_actions(pub, emails): resp = app.get(action_url, status=404) assert 'This action link has already been used or has expired.' in resp.body + # two buttons on the same line, two urls + workflow.possible_status[0].items[1].body = '{% action_button "ok" label="OK" %}{% action_button "ko" label="KO" %} ' + workflow.store() + emails.empty() + formdef.data_class().wipe() + app = login(get_app(pub), username='foo', password='foo') + resp = app.get(formdef.get_url()) + resp = resp.form.submit('submit') + resp = resp.form.submit('submit') + email_data = emails.get('New form2 (test email action)') + assert len(re.findall(r'http.*? ', email_data['payload'])) == 2 + def test_manager_public_access(pub): user, manager = create_user_and_admin(pub) diff --git a/wcs/qommon/emails.py b/wcs/qommon/emails.py index d1462572..48605925 100644 --- a/wcs/qommon/emails.py +++ b/wcs/qommon/emails.py @@ -173,7 +173,7 @@ def email(subject, mail_body, email_rcpt, replyto = None, bcc = None, context['email_signature'] = footer # handle action links/buttons - button_re = re.compile(r'---===BUTTON:(?P[a-zA-Z0-9]*):(?P