summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2002-08-20 14:47:30 (GMT)
committerBarry Warsaw <barry@python.org>2002-08-20 14:47:30 (GMT)
commitdfea3b3963228fc149c586463b01fcaf39510902 (patch)
tree9642e744539d5597d4c0a93b609ffde02a7c25b8
parent75585d4ec18c3b4d42d033c0004a61b6d0704d30 (diff)
downloadcpython-dfea3b3963228fc149c586463b01fcaf39510902.zip
cpython-dfea3b3963228fc149c586463b01fcaf39510902.tar.gz
cpython-dfea3b3963228fc149c586463b01fcaf39510902.tar.bz2
_dispatch(): Use get_content_maintype() and get_content_subtype() to
get the MIME main and sub types, instead of getting the whole ctype and splitting it here. The two more specific methods now correctly implement RFC 2045, section 5.2.
-rw-r--r--Lib/email/Generator.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/Lib/email/Generator.py b/Lib/email/Generator.py
index a8e2cfe..8ce3807 100644
--- a/Lib/email/Generator.py
+++ b/Lib/email/Generator.py
@@ -123,9 +123,8 @@ class Generator:
# self._handle_<maintype>_<subtype>(). If there's no handler for the
# full MIME type, then dispatch to self._handle_<maintype>(). If
# that's missing too, then dispatch to self._writeBody().
- ctype = msg.get_content_type()
- # We do have a Content-Type: header.
- main, sub = ctype.split('/')
+ main = msg.get_content_maintype()
+ sub = msg.get_content_subtype()
specific = UNDERSCORE.join((main, sub)).replace('-', '_')
meth = getattr(self, '_handle_' + specific, None)
if meth is None: