python / cpython

The Python programming language
https://www.python.org
Other
63.42k stars 30.37k forks source link

Add get_content_disposition() to email.message.Message #65282

Closed 7f693efa-c293-4e08-80e6-4c8268e300a5 closed 9 years ago

7f693efa-c293-4e08-80e6-4c8268e300a5 commented 10 years ago
BPO 21083
Nosy @warsaw, @bitdancer
Files
  • c_d.patch
  • c_d-revised.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = None closed_at = created_at = labels = ['type-feature', 'expert-email'] title = 'Add get_content_disposition() to email.message.Message' updated_at = user = 'https://bugs.python.org/brandon-rhodes' ``` bugs.python.org fields: ```python activity = actor = 'r.david.murray' assignee = 'none' closed = True closed_date = closer = 'r.david.murray' components = ['email'] creation = creator = 'brandon-rhodes' dependencies = [] files = ['35177', '35178'] hgrepos = [] issue_num = 21083 keywords = ['patch'] message_count = 9.0 messages = ['215036', '218074', '218076', '218084', '218087', '218088', '218092', '243362', '243363'] nosy_count = 5.0 nosy_names = ['barry', 'r.david.murray', 'brandon-rhodes', 'python-dev', 'abhilash.raj'] pr_nums = [] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue21083' versions = ['Python 3.5'] ```

    7f693efa-c293-4e08-80e6-4c8268e300a5 commented 10 years ago

    "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

    5d4e6c0e-6688-4d45-92fb-ed8fb7a3645b commented 10 years ago

    I read the discussion on issue bpo-21079. Does this issue still needs a patch? If yes I am willing to write one.

    bitdancer commented 10 years ago

    Yes, that would be great.

    5d4e6c0e-6688-4d45-92fb-ed8fb7a3645b commented 10 years ago

    I have attached my patch. Reviews?

    bitdancer commented 10 years ago

    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.

    5d4e6c0e-6688-4d45-92fb-ed8fb7a3645b commented 10 years ago

    I have updated the patch. The header with mime parameter 'filename' in addition to header value is already added, will that not be enough?

    bitdancer commented 10 years ago

    Looks good, thanks.

    1762cc99-3127-4a62-9baf-30c3d0f51ef7 commented 9 years ago

    New changeset 29ba76f5c3dc by R David Murray in branch 'default': bpo-21083: add get_content_disposition method to email.message. https://hg.python.org/cpython/rev/29ba76f5c3dc

    bitdancer commented 9 years ago

    Thanks, Abhilash.