Author: kmtracey
Date: 2010-03-06 09:50:12 -0600 (Sat, 06 Mar 2010)
New Revision: 12688
Modified:
django/trunk/django/core/mail/message.py
django/trunk/tests/regressiontests/mail/tests.py
Log:
Fixed #6918: Adjusted the test in r12683 to more specifically look for what it
is testing so it doesn't get thrown off by other minor differences in email
ouput (hopefully). Also put a docstring back in its place.
Modified: django/trunk/django/core/mail/message.py
===================================================================
--- django/trunk/django/core/mail/message.py 2010-03-06 11:21:48 UTC (rev
12687)
+++ django/trunk/django/core/mail/message.py 2010-03-06 15:50:12 UTC (rev
12688)
@@ -55,8 +55,8 @@
def forbid_multi_line_headers(name, val, encoding):
+ """Forbids multi-line headers, to prevent header injection."""
encoding = encoding or settings.DEFAULT_CHARSET
- """Forbids multi-line headers, to prevent header injection."""
val = force_unicode(val)
if '\n' in val or '\r' in val:
raise BadHeaderError("Header values can't contain newlines (got %r for
header %r)" % (val, name))
Modified: django/trunk/tests/regressiontests/mail/tests.py
===================================================================
--- django/trunk/tests/regressiontests/mail/tests.py 2010-03-06 11:21:48 UTC
(rev 12687)
+++ django/trunk/tests/regressiontests/mail/tests.py 2010-03-06 15:50:12 UTC
(rev 12688)
@@ -147,8 +147,10 @@
>>> msg = EmailMultiAlternatives('Subject', text_content, '[email protected]',
>>> ['[email protected]'])
>>> msg.encoding = 'iso-8859-1'
>>> msg.attach_alternative(html_content, "text/html")
->>> msg.message().as_string()
-'Content-Type: multipart/alternative;
boundary="===============...=="\nMIME-Version: 1.0\nSubject: Subject\nFrom:
[email protected]\nto: [email protected]\ndate: ...\nMessage-ID:
<...>\n\n--===============...==\nContent-Type: text/plain;
charset="iso-8859-1"\nMIME-Version: 1.0\nContent-Transfer-Encoding:
quoted-printable\n\nFirstname S=FCrname is a great
guy.\n--===============...==\nContent-Type: text/html;
charset="iso-8859-1"\nMIME-Version: 1.0\nContent-Transfer-Encoding:
quoted-printable\n\n<p>Firstname S=FCrname is a <strong>great</strong>
guy.</p>\n--===============...==--'
+>>> msg.message().get_payload(0).as_string()
+'Content-Type: text/plain; charset="iso-8859-1"\nMIME-Version:
1.0\nContent-Transfer-Encoding: quoted-printable\n\nFirstname S=FCrname is a
great guy.'
+>>> msg.message().get_payload(1).as_string()
+'Content-Type: text/html; charset="iso-8859-1"\nMIME-Version:
1.0\nContent-Transfer-Encoding: quoted-printable\n\n<p>Firstname S=FCrname is a
<strong>great</strong> guy.</p>'
# Handle attachments within an multipart/alternative mail correctly (#9367)
# (test is not as precise/clear as it could be w.r.t. email tree structure,
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.