mirror of https://github.com/django/django.git
Fixed #6299 -- Fixed an indentation error in django/core/mail.py introduced in [6987]
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6989 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
1264bcf8b0
commit
5496c50b62
|
@ -70,7 +70,7 @@ class BadHeaderError(ValueError):
|
||||||
def forbid_multi_line_headers(name, val):
|
def forbid_multi_line_headers(name, val):
|
||||||
"Forbids multi-line headers, to prevent header injection."
|
"Forbids multi-line headers, to prevent header injection."
|
||||||
if '\n' in val or '\r' in val:
|
if '\n' in val or '\r' in val:
|
||||||
raise BadHeaderError, "Header values can't contain newlines (got %r for header %r)" % (val, name)
|
raise BadHeaderError("Header values can't contain newlines (got %r for header %r)" % (val, name))
|
||||||
try:
|
try:
|
||||||
val = force_unicode(val).encode('ascii')
|
val = force_unicode(val).encode('ascii')
|
||||||
except UnicodeEncodeError:
|
except UnicodeEncodeError:
|
||||||
|
@ -83,7 +83,7 @@ def forbid_multi_line_headers(name, val):
|
||||||
val = ', '.join(result)
|
val = ', '.join(result)
|
||||||
else:
|
else:
|
||||||
val = Header(force_unicode(val), settings.DEFAULT_CHARSET)
|
val = Header(force_unicode(val), settings.DEFAULT_CHARSET)
|
||||||
return (name, val)
|
return name, val
|
||||||
|
|
||||||
class SafeMIMEText(MIMEText):
|
class SafeMIMEText(MIMEText):
|
||||||
def __setitem__(self, name, val):
|
def __setitem__(self, name, val):
|
||||||
|
|
Loading…
Reference in New Issue