#23924: EmailMessage type checks should raise TypeError, not AssertionError
-----------------------------+--------------------
Reporter: martinblech | Owner: nobody
Type: Bug | Status: new
Component: Core (Mail) | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+--------------------
If I run the following code:
{{{#!python
email = EmailMessage(
'Subject', 'Content',
'[email protected]',
'[email protected]')
print(email.message())
}}}
With the `-O` option, I get:
{{{
Traceback (most recent call last):
File "x.py", line 6, in <module>
'[email protected]')
File "/home/berker/hacking/django/django/core/mail/message.py", line
227, in __init__
assert not isinstance(to, six.string_types), '"to" argument must be a
list or tuple'
AssertionError: "to" argument must be a list or tuple
}}}
But without it, it fails silently and produces a broken `To` header:
{{{
From nobody Wed Nov 26 18:30:08 2014
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Subject: Subject
From: [email protected]
To: t, o, @, e, x, a, m, p, l, e, ., c, o, m
Date: Wed, 26 Nov 2014 18:30:08 -0000
Message-ID: <20141126183008.1632.71698@rama>
Content
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23924>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.7540f47069c98f859b21b16ef8c35c4c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.