Projet

Général

Profil

0001-encode-buttons-on-action-links-emails-25721.patch

Thomas Noël, 20 août 2018 16:58

Télécharger (2,02 ko)

Voir les différences:

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(-)
tests/test_form_pages.py
4931 4931
    # change email subjects to differentiate them
4932 4932
    workflow.possible_status[0].items[0].subject = 'New form ([name])'
4933 4933
    workflow.possible_status[0].items[1].subject = 'New form2 ([name])'
4934
    workflow.possible_status[0].items[1].body = 'Hello; {% action_button "do-accept" label="Accept!" %} Bye.'
4934
    workflow.possible_status[0].items[1].body = 'Hello; {% action_button "do-accept" label="Accepté!" %} Adiós.'
4935 4935
    workflow.possible_status[1].items[1].identifier = 'do-accept'
4936 4936
    workflow.store()
4937 4937

  
......
4956 4956

  
4957 4957
    app = get_app(pub)
4958 4958
    resp = app.get(action_url)
4959
    assert 'Accept!' in resp.body
4959
    assert 'Accepté!' in resp.body
4960 4960
    resp = resp.form.submit()
4961 4961
    assert 'The action has been confirmed.' in resp.body
4962 4962
    assert formdef.data_class().count() == 1
wcs/qommon/emails.py
188 188
            'label': match.group('label'),
189 189
            'url': get_action_url(match),
190 190
        }
191
        return render_to_string('qommon/email_button_link.html', context)
191
        return render_to_string('qommon/email_button_link.html', context).encode(encoding)
192 192

  
193 193
    text_body = button_re.sub(text_button, text_body) if text_body else None
194 194
    html_body = button_re.sub(html_button, html_body) if html_body else None
195
-