allow multiple "action links" by line (#27853)

This commit is contained in:
Thomas NOËL 2018-11-08 12:08:41 +01:00
parent 459e99e8ba
commit 18dedba966
2 changed files with 13 additions and 1 deletions

View File

@ -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)

View File

@ -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<token>[a-zA-Z0-9]*):(?P<label>.*)===---')
button_re = re.compile(r'---===BUTTON:(?P<token>[a-zA-Z0-9]*):(?P<label>.*?)===---')
def get_action_url(match):
return '%s/actions/%s/' % (