summaryrefslogtreecommitdiff
path: root/addons/web/controllers/main.py
diff options
context:
space:
mode:
authorJulien Castiaux <juc@odoo.com>2019-08-21 14:43:43 +0000
committerJulien Castiaux <juc@odoo.com>2019-09-19 14:24:31 +0000
commit18299d7e5051cdad29854bc7280db5002a209500 (patch)
treeae21849c0eb2cf7f56ba56ebd067f2bff4f23374 /addons/web/controllers/main.py
parentdbb6cfdbf803d2ab86ba11450b5928abf5ab658b (diff)
[REF] base,mail,tools: use new python email API
[PEP 594] is going to depreciate the legacy `email.message.Message` API and its related modules: `email.(charset|header|mime|utils)`. The new `email.message.EmailMessage` API exposes a much easier interface to create multiparted emails [1], is capable of doing all the necessary headers value conversion (RFCs [2045], [2047], [2049]) [2] and get/set different flavor of payload (text/bytes) in a straightforward way [3]. All headers are structured in a way to support python native types, i.e. the `Date` header supports `datetime.datetime` objects and automatically performs the required formatting. The same goes for multi-valued headers like the `To` header, one can directly set a python list of values, it will be automatically be formatted according to the RFCs. The dedicated encoding and decoding functions are no more needed thus has been removed has part of the refactor. FTR, [RFC2231] is an update of [RFC2047] and based on tests we've just conducted, both GMail and Thunderbird now support RFC2231 encoding just fine in all headers: attachments names, From, etc. [1]: http://docs.python.org/3/library/email.message.html [2]: http://docs.python.org/3/library/email.headerregistry.html [3]: http://docs.python.org/3/library/email.contentmanager.html [2045]: https://tools.ietf.org/html/rfc2045 [2047]: https://tools.ietf.org/html/rfc2047 [2049]: https://tools.ietf.org/html/rfc2049 [2231]: https://tools.ietf.org/html/rfc2231 closes odoo/odoo#35929 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
Diffstat (limited to 'addons/web/controllers/main.py')
0 files changed, 0 insertions, 0 deletions