mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
#21083: add get_content_disposition method to email.message.
Patch by Abhilash Raj.
This commit is contained in:
parent
b9cec6a30f
commit
b744f3a45e
5 changed files with 41 additions and 0 deletions
|
|
@ -927,6 +927,18 @@ class Message:
|
|||
"""
|
||||
return [part.get_content_charset(failobj) for part in self.walk()]
|
||||
|
||||
def get_content_disposition(self):
|
||||
"""Return the message's content-disposition if it exists, or None.
|
||||
|
||||
The return values can be either 'inline', 'attachment' or None
|
||||
according to the rfc2183.
|
||||
"""
|
||||
value = self.get('content-disposition')
|
||||
if value is None:
|
||||
return None
|
||||
c_d = _splitparam(value)[0].lower()
|
||||
return c_d
|
||||
|
||||
# I.e. def walk(self): ...
|
||||
from email.iterators import walk
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue