Projet

Général

Profil

« Précédent | Suivant » 

Révision f46f80e4

Ajouté par Serghei Mihai (congés, retour 15/05) il y a plus de 6 ans

add unsubscription link in mail headers (#19579)

Voir les différences:

corbo/utils.py
60 60
                                           'identifier': dest})
61 61
        unsubscribe_link = urlparse.urljoin(settings.SITE_BASE_URL, reverse(
62 62
            'unsubscribe', kwargs={'unsubscription_token': unsubscribe_token}))
63
        message.set_headers({'List-Unsubscribe': '<%s>' % unsubscribe_link})
63 64
        message.html = orig_html.replace(UNSUBSCRIBE_LINK_PLACEHOLDER, unsubscribe_link)
64 65
        message.text = orig_text.replace(UNSUBSCRIBE_LINK_PLACEHOLDER, unsubscribe_link)
65 66

  
tests/test_emailing.py
134 134
                index = i*subscriptions_number+counter
135 135
                signature = urllib.unquote(re.findall('/unsubscribe/(.*)"', mail.outbox[index].html)[0])
136 136
                unsubscription_link = reverse('unsubscribe', kwargs={'unsubscription_token': signature})
137
                assert mail.outbox[index]._headers['List-Unsubscribe'] == '<http://localhost%s>' % unsubscription_link
137 138
                assert unsubscription_link in mail.outbox[index].html
138 139
                assert unsubscription_link in mail.outbox[index].text
139 140
                assert unsubscription_link_sentinel != unsubscription_link

Formats disponibles : Unified diff