Serhiy Storchaka added the comment:
Following expression looks more clear to me:
c_d is not None and c_d.content_disposition == 'attachment'
--
nosy: +serhiy.storchaka
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21079
Roundup Robot added the comment:
New changeset 0044ed0af96f by R David Murray in branch '3.4':
#21079: is_attachment now looks only at the value, ignoring parameters.
https://hg.python.org/cpython/rev/0044ed0af96f
--
nosy: +python-dev
___
Python
Roundup Robot added the comment:
New changeset 54392c4a8880 by R David Murray in branch 'default':
Merge: #21079: is_attachment now looks only at the value, ignoring parameters.
https://hg.python.org/cpython/rev/54392c4a8880
--
___
Python tracker
Changes by R. David Murray rdmur...@bitdance.com:
--
resolution: - fixed
stage: - resolved
status: open - closed
versions: +Python 3.5
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21079
Brandon Rhodes added the comment:
Thanks — done! http://bugs.python.org/issue21083
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21079
___
___
New submission from Brandon Rhodes:
Most attachments (in my inbox, at least) specify a filename, and thus
have a Content-Disposition header that looks like:
Content-Disposition: attachment; filename=attachment.gz
In fact, this sample header was generated by the new add_attachment()
method in
Brandon Rhodes added the comment:
Oh - this also, happily, explains why iter_attachments() is ignoring
all of the attachments on my email: because it internally relies upon
is_attachment to make the decision. So this fix will also make
iter_attachments() usable!
--
Brandon Rhodes added the comment:
Okay, having looked at the source a bit more it would probably make
more sense to use _splitparam() instead of doing the split manually.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21079
Brandon Rhodes added the comment:
Given that methods like get_param() already exist for pulling data out of
the right-hand-side of the ';' in a parameterized email header, would it
be amiss for EmailMessage to also have a method that either returns
everything to the left of the semicolon, or
R. David Murray added the comment:
That facility already mostly exists. The bug is that the code in question
doesn't use it.
m['Content-Disposition'].content_disposition
'attachment'
m['Content-Disposition'].params
{'filename': 'attachment.gz'}
On the other hand, looking at that it is
R. David Murray added the comment:
Here's patch.
--
keywords: +patch
Added file: http://bugs.python.org/file34641/is_attachment.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21079
___
R. David Murray added the comment:
I was going to open new issue for adding 'value', but looking at the parsing
code I see why I didn't add one. The way the new parser works it really wants
to know the actual structure of the value, it doesn't have a good way to treat
it as generic. We
Brandon Rhodes added the comment:
Understood. I wonder where in the documentation the ability to get the content
disposition should wind up? I am almost tempted to suggest a
get_content_disposition() method that parallels get_content_type(), mostly to
avoid having to document the asymmetry
R. David Murray added the comment:
Well, that's why is_attachment exists. I wouldn't be averse to adding
get_content_disposition if nobody objects, though.
The attributes are on the headers because the data really is attributes of the
parsed headers, but the more useful user API is the
Brandon Rhodes added the comment:
I agree that is_attachment supports the most common use-case of people who need
to inspect the content disposition!
But people implementing heavyweight tools and email clients might additionally
need to distinguish between a MIME part whose disposition is
R. David Murray added the comment:
OK. If you would be willing to open a feature request for that, that would be
great.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21079
___
16 matches
Mail list logo