diff options
| author | Julien Castiaux <juc@odoo.com> | 2019-08-20 13:09:55 +0000 |
|---|---|---|
| committer | Julien Castiaux <juc@odoo.com> | 2019-09-17 11:32:54 +0000 |
| commit | dbb6cfdbf803d2ab86ba11450b5928abf5ab658b (patch) | |
| tree | 830220c1e66d96736e097219949b724b9db0744e /addons/test_mail/tests/common.py | |
| parent | 1b057dd76b19db00eb5b63dc02f87cdc13cc07cf (diff) | |
[REF] mail: remove deprecated email formataddr
[PEP 594] is going to depreciate the legacy `email.message.Message` API
and its related modules. Among them the `email.utils.formataddr`
function, this function takes a `(name, email)` pair and returns a
string value suitable for From, To and Cc headers.
The stdlib function is capable of handling several character encoding
and two binary-to-ascii encoding. Odoo only uses `utf-8` which is
compatible with the base64 b2a encoding. The re-implementation of that
function has been simplified to only support base64-ed utf-8 and ascii.
[PEP 594]: https://www.python.org/dev/peps/pep-0594/\#email-lagacy-api
Diffstat (limited to 'addons/test_mail/tests/common.py')
| -rw-r--r-- | addons/test_mail/tests/common.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/test_mail/tests/common.py b/addons/test_mail/tests/common.py index 17d8594a7d9..d73a091b7b2 100644 --- a/addons/test_mail/tests/common.py +++ b/addons/test_mail/tests/common.py @@ -4,12 +4,12 @@ import json import time from contextlib import contextmanager -from email.utils import formataddr from functools import partial from odoo import api from odoo.addons.bus.models.bus import json_dump from odoo.tests import common, tagged, new_test_user +from odoo.tools import formataddr mail_new_test_user = partial(new_test_user, context={'mail_create_nolog': True, 'mail_create_nosubscribe': True, 'mail_notrack': True, 'no_reset_password': True}) @@ -327,7 +327,7 @@ class MockEmails(common.SingleTransactionCase): self._mails[:] = [] def format(self, template, to='groups@example.com, other@gmail.com', subject='Frogs', - extra='', email_from='Sylvie Lelitre <test.sylvie.lelitre@agrolait.com>', + extra='', email_from='"Sylvie Lelitre" <test.sylvie.lelitre@agrolait.com>', cc='', msg_id='<1198923581.41972151344608186760.JavaMail@agrolait.com>'): return template.format(to=to, subject=subject, cc=cc, extra=extra, email_from=email_from, msg_id=msg_id) |
