mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
unicode: Changed StrAndUnicode class to be consistent with everything else as
to the encoding of bytestrings. git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5101 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
ee0bc3b6c8
commit
080cebaf69
@ -47,13 +47,10 @@ def smart_str(s, encoding='utf-8', strings_only=False):
|
||||
|
||||
class StrAndUnicode(object):
|
||||
"""
|
||||
A class whose __str__ returns its __unicode__ as a bytestring
|
||||
according to settings.DEFAULT_CHARSET.
|
||||
A class whose __str__ returns its __unicode__ as a UTF-8 bytestring.
|
||||
|
||||
Useful as a mix-in.
|
||||
"""
|
||||
def __str__(self):
|
||||
# XXX: (Malcolm) Correct encoding? Be variable and use UTF-8 as
|
||||
# default?
|
||||
return self.__unicode__().encode(settings.DEFAULT_CHARSET)
|
||||
return self.__unicode__().encode('utf-8')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user