Projet

Général

Profil

0001-allow-multiple-action-links-by-line-27853.patch

Thomas Noël, 08 novembre 2018 12:08

Télécharger (1,87 ko)

Voir les différences:

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(-)
tests/test_form_pages.py
5127 5127
    resp = app.get(action_url, status=404)
5128 5128
    assert 'This action link has already been used or has expired.' in resp.body
5129 5129

  
5130
    # two buttons on the same line, two urls
5131
    workflow.possible_status[0].items[1].body = '{% action_button "ok" label="OK" %}{% action_button "ko" label="KO" %} '
5132
    workflow.store()
5133
    emails.empty()
5134
    formdef.data_class().wipe()
5135
    app = login(get_app(pub), username='foo', password='foo')
5136
    resp = app.get(formdef.get_url())
5137
    resp = resp.form.submit('submit')
5138
    resp = resp.form.submit('submit')
5139
    email_data = emails.get('New form2 (test email action)')
5140
    assert len(re.findall(r'http.*? ', email_data['payload'])) == 2
5141

  
5130 5142
def test_manager_public_access(pub):
5131 5143
    user, manager = create_user_and_admin(pub)
5132 5144

  
wcs/qommon/emails.py
173 173
    context['email_signature'] = footer
174 174

  
175 175
    # handle action links/buttons
176
    button_re = re.compile(r'---===BUTTON:(?P<token>[a-zA-Z0-9]*):(?P<label>.*)===---')
176
    button_re = re.compile(r'---===BUTTON:(?P<token>[a-zA-Z0-9]*):(?P<label>.*?)===---')
177 177

  
178 178
    def get_action_url(match):
179 179
        return '%s/actions/%s/' % (
180
-