#28042: mimetype Fallback for attachments passed to EmailMessage.__init__ removed --------------------------------+-------------------------------------- Reporter: Dariusz Paluch | Owner: nobody Type: Bug | Status: new Component: Core (Mail) | Version: 1.11 Severity: Normal | Resolution: Keywords: | Triage Stage: Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 --------------------------------+-------------------------------------- Description changed by Dariusz Paluch:
Old description: > {{{ > Traceback (most recent call last): > File "/usr/local/lib/python3.4/dist- > packages/IPython/core/interactiveshell.py", line 2881, in run_code > exec(code_obj, self.user_global_ns, self.user_ns) > File "<ipython-input-43-5151166d7cfd>", line 1, in <module> > m.message() > File "/usr/local/lib/python3.4/dist- > packages/django/core/mail/message.py", line 302, in message > msg = self._create_message(msg) > File "/usr/local/lib/python3.4/dist- > packages/django/core/mail/message.py", line 399, in _create_message > return self._create_attachments(msg) > File "/usr/local/lib/python3.4/dist- > packages/django/core/mail/message.py", line 412, in _create_attachments > msg.attach(self._create_attachment(*attachment)) > File "/usr/local/lib/python3.4/dist- > packages/django/core/mail/message.py", line 450, in _create_attachment > attachment = self._create_mime_attachment(content, mimetype) > File "/usr/local/lib/python3.4/dist- > packages/django/core/mail/message.py", line 422, in > _create_mime_attachment > basetype, subtype = mimetype.split('/', 1) > AttributeError: 'NoneType' object has no attribute 'split' > }}} New description: {{{ >>> m = EmailMessage(attachments=[('filename1', 'content1',)]) >>> m.attach('filename2', 'content2') >>> m.attachments [('filename1', 'content1'), ('filename2', 'content2', 'application/octet-stream')] >>> m.message() Traceback (most recent call last): File "/usr/local/lib/python3.4/dist- packages/IPython/core/interactiveshell.py", line 2881, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-53-5151166d7cfd>", line 1, in <module> m.message() File "/usr/local/lib/python3.4/dist- packages/django/core/mail/message.py", line 302, in message msg = self._create_message(msg) File "/usr/local/lib/python3.4/dist- packages/django/core/mail/message.py", line 399, in _create_message return self._create_attachments(msg) File "/usr/local/lib/python3.4/dist- packages/django/core/mail/message.py", line 412, in _create_attachments msg.attach(self._create_attachment(*attachment)) File "/usr/local/lib/python3.4/dist- packages/django/core/mail/message.py", line 450, in _create_attachment attachment = self._create_mime_attachment(content, mimetype) File "/usr/local/lib/python3.4/dist- packages/django/core/mail/message.py", line 422, in _create_mime_attachment basetype, subtype = mimetype.split('/', 1) AttributeError: 'NoneType' object has no attribute 'split' }}} This code was work in 1.10 -- -- Ticket URL: <https://code.djangoproject.com/ticket/28042#comment:2> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/064.ffada2a77d1714f6849cea58dd12e36f%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.