diff options
author | R David Murray <rdmurray@bitdance.com> | 2015-05-16 19:41:07 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2015-05-16 19:41:07 (GMT) |
commit | b744f3a45e3228ea2b344c8cf9424e2592dc93b7 (patch) | |
tree | d642d35aa8a2fb02ce9ef8ba8354126d366ff6f0 /Lib/email | |
parent | b9cec6a30f77c4c0ab208053ffafc02fddd01962 (diff) | |
download | cpython-b744f3a45e3228ea2b344c8cf9424e2592dc93b7.zip cpython-b744f3a45e3228ea2b344c8cf9424e2592dc93b7.tar.gz cpython-b744f3a45e3228ea2b344c8cf9424e2592dc93b7.tar.bz2 |
#21083: add get_content_disposition method to email.message.
Patch by Abhilash Raj.
Diffstat (limited to 'Lib/email')
-rw-r--r-- | Lib/email/message.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/email/message.py b/Lib/email/message.py index 3d3138f..a892012 100644 --- a/Lib/email/message.py +++ b/Lib/email/message.py @@ -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 |