[Django] #28042: mimetype Fallback for attachments passed to EmailMessage.__init__ removed

18 views
Skip to first unread message

Django

unread,
Apr 6, 2017, 10:46:31 AM4/6/17
to django-...@googlegroups.com
#28042: mimetype Fallback for attachments passed to EmailMessage.__init__ removed
------------------------------------------+------------------------
Reporter: Dariusz Paluch | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
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'

--
Ticket URL: <https://code.djangoproject.com/ticket/28042>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 6, 2017, 10:50:35 AM4/6/17
to django-...@googlegroups.com
#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
--------------------------------+--------------------------------------
Changes (by Tim Graham):

* component: Uncategorized => Core (Mail)


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:

{{{


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'
}}}

--

Comment:

Can you please provide code to reproduce the issue?

--
Ticket URL: <https://code.djangoproject.com/ticket/28042#comment:1>

Django

unread,
Apr 6, 2017, 10:53:46 AM4/6/17
to django-...@googlegroups.com
#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

unread,
Apr 6, 2017, 1:10:51 PM4/6/17
to django-...@googlegroups.com
#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: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham):

* severity: Normal => Release blocker
* stage: Unreviewed => Accepted


Comment:

Regression in 72d541b61cd7b0a14f70242e2207fdb3f600c4d5.

--
Ticket URL: <https://code.djangoproject.com/ticket/28042#comment:3>

Django

unread,
Apr 7, 2017, 6:19:49 AM4/7/17
to django-...@googlegroups.com
#28042: mimetype Fallback for attachments passed to EmailMessage.__init__ removed
---------------------------------+------------------------------------
Reporter: Dariusz Paluch | Owner: Nikolay
Type: Bug | Status: assigned

Component: Core (Mail) | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Nikolay):

* owner: nobody => Nikolay
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/28042#comment:4>

Django

unread,
Apr 7, 2017, 7:15:26 AM4/7/17
to django-...@googlegroups.com
#28042: mimetype Fallback for attachments passed to EmailMessage.__init__ removed
---------------------------------+------------------------------------
Reporter: Dariusz Paluch | Owner: Nikolay
Type: Bug | Status: closed

Component: Core (Mail) | Version: 1.11
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Nikolay):

* status: assigned => closed
* resolution: => fixed


Comment:

https://github.com/django/django/pull/8323

--
Ticket URL: <https://code.djangoproject.com/ticket/28042#comment:5>

Django

unread,
Apr 7, 2017, 7:41:06 AM4/7/17
to django-...@googlegroups.com
#28042: mimetype Fallback for attachments passed to EmailMessage.__init__ removed
---------------------------------+------------------------------------
Reporter: Dariusz Paluch | Owner: Nikolay
Type: Bug | Status: new

Component: Core (Mail) | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham):

* status: closed => new
* has_patch: 0 => 1
* resolution: fixed =>


Comment:

The ticket is closed when the patch is merged. Please check "Has patch"
when adding a pull request. See
[https://docs.djangoproject.com/en/dev/internals/contributing/triaging-
tickets/ Triaging Tickets] for workflow details.

--
Ticket URL: <https://code.djangoproject.com/ticket/28042#comment:6>

Django

unread,
Apr 7, 2017, 12:04:53 PM4/7/17
to django-...@googlegroups.com
#28042: mimetype Fallback for attachments passed to EmailMessage.__init__ removed
---------------------------------+------------------------------------
Reporter: Dariusz Paluch | Owner: Nikolay
Type: Bug | Status: new

Component: Core (Mail) | Version: 1.11
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/28042#comment:7>

Django

unread,
Apr 7, 2017, 6:21:30 PM4/7/17
to django-...@googlegroups.com
#28042: mimetype Fallback for attachments passed to EmailMessage.__init__ removed
---------------------------------+------------------------------------
Reporter: Dariusz Paluch | Owner: Nikolay
Type: Bug | Status: closed

Component: Core (Mail) | Version: 1.11
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"dd001848920713fe616c03db6946762e8aa7c4e3" dd00184]:
{{{
#!CommitTicketReference repository=""
revision="dd001848920713fe616c03db6946762e8aa7c4e3"
Fixed #28042 -- Fixed crash when using a two-tuple in EmailMessage's
attachments arg.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28042#comment:8>

Django

unread,
Apr 7, 2017, 6:24:43 PM4/7/17
to django-...@googlegroups.com
#28042: mimetype Fallback for attachments passed to EmailMessage.__init__ removed
---------------------------------+------------------------------------
Reporter: Dariusz Paluch | Owner: Nikolay
Type: Bug | Status: closed
Component: Core (Mail) | Version: 1.11
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"734e6bb2b884eb4681954e1d0c01097fe167f558" 734e6bb2]:
{{{
#!CommitTicketReference repository=""
revision="734e6bb2b884eb4681954e1d0c01097fe167f558"
[1.11.x] Fixed #28042 -- Fixed crash when using a two-tuple in
EmailMessage's attachments arg.

Backport of dd001848920713fe616c03db6946762e8aa7c4e3 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/28042#comment:9>

Reply all
Reply to author
Forward
0 new messages