summaryrefslogtreecommitdiff
path: root/django/core
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-06-01 07:30:40 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-06-01 07:30:40 +0000
commit554f4e7aa8a3ffe65cac3b6698906c06e7db4fe6 (patch)
treec014732f8ef6dddcaa198e04d8701c9f4afababe /django/core
parent7a30b4e03ae8848792bd114741bc2fb175d280a4 (diff)
unicode: Reverted [5388] and fixed the problem in a different way. Checked
every occurrence of smart_unicode() and force_unicode() that was not previously a str() call, so hopefully the problems will not reoccur. Fixed #4447. Refs #4435, #4430. git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5400 bcc190cf-cafb-0310-a4f2-bffc1f526a37
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)