Code

Ticket #6299: patch_6299.txt

File patch_6299.txt, 1.9 KB (added by jholloway7+django@…, 6 years ago)

patch for indentation error

Line 
1Index: /home/joe/code/workspaces/clinicnotes/clinicnotes/src_django/django/core/mail.py
2===================================================================
3--- /home/joe/code/workspaces/clinicnotes/clinicnotes/src_django/django/core/mail.py    (revision 6988)
4+++ /home/joe/code/workspaces/clinicnotes/clinicnotes/src_django/django/core/mail.py    (working copy)
5@@ -68,21 +68,21 @@
6     pass
7 
8 def forbid_multi_line_headers(name, val):
9-        "Forbids multi-line headers, to prevent header injection."
10-        if '\n' in val or '\r' in val:
11-            raise BadHeaderError, "Header values can't contain newlines (got %r for header %r)" % (val, name)
12-        try:
13-            val = force_unicode(val).encode('ascii')
14-        except UnicodeEncodeError:
15-            if name.lower() in ('to', 'from', 'cc'):
16-                result = []
17-                for item in val.split(', '):
18-                    nm, addr = parseaddr(item)
19-                    nm = str(Header(nm, settings.DEFAULT_CHARSET))
20-                    result.append(formataddr((nm, str(addr))))
21-                val = ', '.join(result)
22-            else:
23-                val = Header(force_unicode(val), settings.DEFAULT_CHARSET)
24+    "Forbids multi-line headers, to prevent header injection."
25+    if '\n' in val or '\r' in val:
26+        raise BadHeaderError, "Header values can't contain newlines (got %r for header %r)" % (val, name)
27+    try:
28+        val = force_unicode(val).encode('ascii')
29+    except UnicodeEncodeError:
30+        if name.lower() in ('to', 'from', 'cc'):
31+            result = []
32+            for item in val.split(', '):
33+                nm, addr = parseaddr(item)
34+                nm = str(Header(nm, settings.DEFAULT_CHARSET))
35+                result.append(formataddr((nm, str(addr))))
36+            val = ', '.join(result)
37+        else:
38+            val = Header(force_unicode(val), settings.DEFAULT_CHARSET)
39     return (name, val)
40 
41 class SafeMIMEText(MIMEText):