Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #6918: Adjusted the test in r12683 to more specifically look fo…

…r 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.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12688 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit a2c4ad1dabf58130e0c97636dd401bb615f715ee 1 parent bb3d93f
Karen Tracey authored March 06, 2010
2  django/core/mail/message.py
@@ -55,8 +55,8 @@ def make_msgid(idstring=None):
55 55
 
56 56
 
57 57
 def forbid_multi_line_headers(name, val, encoding):
58  
-    encoding = encoding or settings.DEFAULT_CHARSET
59 58
     """Forbids multi-line headers, to prevent header injection."""
  59
+    encoding = encoding or settings.DEFAULT_CHARSET
60 60
     val = force_unicode(val)
61 61
     if '\n' in val or '\r' in val:
62 62
         raise BadHeaderError("Header values can't contain newlines (got %r for header %r)" % (val, name))
6  tests/regressiontests/mail/tests.py
@@ -147,8 +147,10 @@
147 147
 >>> msg = EmailMultiAlternatives('Subject', text_content, 'from@example.com', ['to@example.com'])
148 148
 >>> msg.encoding = 'iso-8859-1'
149 149
 >>> msg.attach_alternative(html_content, "text/html")
150  
->>> msg.message().as_string()
151  
-'Content-Type: multipart/alternative; boundary="===============...=="\nMIME-Version: 1.0\nSubject: Subject\nFrom: from@example.com\nTo: to@example.com\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--===============...==--'
  150
+>>> msg.message().get_payload(0).as_string()
  151
+'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.'
  152
+>>> msg.message().get_payload(1).as_string()
  153
+'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>'
152 154
 
153 155
 # Handle attachments within an multipart/alternative mail correctly (#9367)
154 156
 # (test is not as precise/clear as it could be w.r.t. email tree structure,

0 notes on commit a2c4ad1

Please sign in to comment.
Something went wrong with that request. Please try again.