Issue 32975: mailbox: It would be nice to move mailbox.Message from legacy email.message.Message API to new EmailMessage API (original) (raw)
This issue has been migrated to GitHub: https://github.com/python/cpython/issues/77156
classification
Title: | mailbox: It would be nice to move mailbox.Message from legacy email.message.Message API to new EmailMessage API | ||
---|---|---|---|
Type: | enhancement | Stage: | |
Components: | Versions: | Python 3.8 |
process
Status: | open | Resolution: | |
---|---|---|---|
Dependencies: | Superseder: | ||
Assigned To: | Nosy List: | barry, maxking, r.david.murray | |
Priority: | normal | Keywords: |
Created on 2018-03-01 05:44 by maxking, last changed 2022-04-11 14:58 by admin.
Messages (4) | ||
---|---|---|
msg313082 - (view) | Author: Abhilash Raj (maxking) * ![]() |
Date: 2018-03-01 05:44 |
Since Python 3.6 the new EmailMessage API seems to be the default but mailbox.Message still subclasses from the old email.message.Message API. It would be nice to get EmailMessage from mailbox so that one can rely on the new methods and content managers. Also, while it is possible to pass a constructor to mailbox.mbox to get the new EmailMessage style message, it is different from mailbox.Message which has some extra methods. | ||
msg313083 - (view) | Author: Abhilash Raj (maxking) * ![]() |
Date: 2018-03-01 06:00 |
I should also mention probably that I went ahead and made changes to make this work and I can pass most of the tests, one is failing due to missing `\n` character in the header's value obtained from `msg.get_all('Received')`. I can make a pull request on Github if that would be a good place to start the discussion instead. | ||
msg313120 - (view) | Author: R. David Murray (r.david.murray) * ![]() |
Date: 2018-03-02 01:25 |
This is a reasonable request (a good way to use EmailMessage), but EmailMessage is not yet the default even for the email package. You have to specify policy=default to get it (or use it to construct a message). Mailbox probably needs some backward compatible way for the user to specify the policy. | ||
msg313122 - (view) | Author: Abhilash Raj (maxking) * ![]() |
Date: 2018-03-02 02:29 |
Can you suggest what would be the best way go about doing that? Given that mailbox.Message subclasses from Message, I am not sure how to proceed about this to make this configurable with a flag. I haven't yet made a PR, but this[1] is the URL to the change I made. [1]: https://github.com/python/cpython/compare/master...maxking:fix-mailbox |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:58 | admin | set | github: 77156 |
2018-03-02 02:29:36 | maxking | set | messages: + |
2018-03-02 01:25:41 | r.david.murray | set | messages: + versions: + Python 3.8, - Python 3.6 |
2018-03-01 06:00:31 | maxking | set | messages: + |
2018-03-01 05:44:18 | maxking | create |