summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
Diffstat (limited to 'django/core')
-rw-r--r--django/core/mail.py6
-rw-r--r--django/core/serializers/python.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/django/core/mail.py b/django/core/mail.py
index 2ccc753b22..9190a55989 100644
--- a/django/core/mail.py
+++ b/django/core/mail.py
@@ -3,7 +3,7 @@ Tools for sending email.
"""
from django.conf import settings
-from django.utils.encoding import smart_str, smart_unicode
+from django.utils.encoding import smart_str, force_unicode
from email.MIMEText import MIMEText
from email.Header import Header
from email.Utils import formatdate, parseaddr, formataddr
@@ -62,7 +62,7 @@ class SafeMIMEText(MIMEText):
if '\n' in val or '\r' in val:
raise BadHeaderError, "Header values can't contain newlines (got %r for header %r)" % (val, name)
try:
- val = str(smart_unicode(val))
+ val = str(force_unicode(val))
except UnicodeEncodeError:
if name.lower() in ('to', 'from', 'cc'):
result = []
@@ -72,7 +72,7 @@ class SafeMIMEText(MIMEText):
result.append(formataddr((nm, str(addr))))
val = ', '.join(result)
else:
- val = Header(smart_unicode(val), settings.DEFAULT_CHARSET)
+ val = Header(force_unicode(val), settings.DEFAULT_CHARSET)
MIMEText.__setitem__(self, name, val)
class SMTPConnection(object):
diff --git a/django/core/serializers/python.py b/django/core/serializers/python.py
index c0d2efab50..f61a2fa4a2 100644
--- a/django/core/serializers/python.py
+++ b/django/core/serializers/python.py
@@ -69,7 +69,7 @@ def Deserializer(object_list, **options):
# Handle each field
for (field_name, field_value) in d["fields"].iteritems():
if isinstance(field_value, str):
- field_value = smart_unicode(field_value, options.get("encoding", settings.DEFAULT_CHARSET))
+ field_value = smart_unicode(field_value, options.get("encoding", settings.DEFAULT_CHARSET), strings_only=True)
field = Model._meta.get_field(field_name)