This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Add get_content_disposition() to email.message.Message
Type: enhancement Stage: resolved
Components: email Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: abhilash.raj, barry, brandon-rhodes, python-dev, r.david.murray
Priority: normal Keywords: patch

Created on 2014-03-28 11:13 by brandon-rhodes, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
c_d.patch abhilash.raj, 2014-05-07 21:59 review
c_d-revised.patch abhilash.raj, 2014-05-07 22:35 review
Messages (9)
msg215036 - (view) Author: Brandon Rhodes (brandon-rhodes) * Date: 2014-03-28 11:13
"Content-Disposition is an optional header field. In its absence, the MUA may use whatever presentation method it deems suitable." — RFC 2183

The email.message.Message class should gain a get_content_disposition() method with the three possible return values 'inline', 'attachment', and None so that email clients can easily distinguish between the three states described in the RFC.

See also the discussion at http://bugs.python.org/issue21079
msg218074 - (view) Author: Abhilash Raj (abhilash.raj) * Date: 2014-05-07 20:37
I read the discussion on issue #21079. Does this issue still needs a patch? If yes I am willing to write one.
msg218076 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-05-07 20:48
Yes, that would be great.
msg218084 - (view) Author: Abhilash Raj (abhilash.raj) * Date: 2014-05-07 21:59
I have attached my patch. Reviews?
msg218087 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-05-07 22:09
Looks pretty good.

The docs should say that the value of header is returned, and should also mentioned that the value is lower cased.  You should also add a 'versionadded' directive, and for bonus points an entry in the whatsnew document for 3.5.  Also, all three possible values should be tested, and a mixed case version of at last one of them, as well as a header that mime parameters in addition to the header value.
msg218088 - (view) Author: Abhilash Raj (abhilash.raj) * Date: 2014-05-07 22:35
I have updated the patch. The header with mime parameter 'filename' in addition to header value is already added, will that not be enough?
msg218092 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2014-05-07 23:39
Looks good, thanks.
msg243362 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-05-16 19:41
New changeset 29ba76f5c3dc by R David Murray in branch 'default':
#21083: add get_content_disposition method to email.message.
https://hg.python.org/cpython/rev/29ba76f5c3dc
msg243363 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-05-16 19:42
Thanks, Abhilash.
History
Date User Action Args
2022-04-11 14:58:00adminsetgithub: 65282
2015-05-16 19:42:03r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg243363

stage: commit review -> resolved
2015-05-16 19:41:21python-devsetnosy: + python-dev
messages: + msg243362
2014-09-20 21:35:55r.david.murraysetstage: commit review
2014-05-07 23:39:51r.david.murraysetmessages: + msg218092
2014-05-07 22:35:18abhilash.rajsetfiles: + c_d-revised.patch

messages: + msg218088
2014-05-07 22:09:37r.david.murraysetmessages: + msg218087
2014-05-07 21:59:39abhilash.rajsetfiles: + c_d.patch
keywords: + patch
messages: + msg218084
2014-05-07 20:48:55r.david.murraysetmessages: + msg218076
2014-05-07 20:37:41abhilash.rajsetnosy: + abhilash.raj
messages: + msg218074
2014-03-28 11:13:22brandon-rhodescreate