mirror of
https://github.com/django/django.git
synced 2025-10-25 22:56:12 +00:00
Fixed #18269 -- Applied unicode_literals for Python 3 compatibility.
Thanks Vinay Sajip for the support of his django3 branch and Jannis Leidel for the review.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import urllib
|
||||
import locale
|
||||
import datetime
|
||||
@@ -80,7 +82,7 @@ def force_unicode(s, encoding='utf-8', strings_only=False, errors='strict'):
|
||||
# without raising a further exception. We do an
|
||||
# approximation to what the Exception's standard str()
|
||||
# output should be.
|
||||
s = u' '.join([force_unicode(arg, encoding, strings_only,
|
||||
s = ' '.join([force_unicode(arg, encoding, strings_only,
|
||||
errors) for arg in s])
|
||||
elif not isinstance(s, unicode):
|
||||
# Note: We use .decode() here, instead of unicode(s, encoding,
|
||||
@@ -96,7 +98,7 @@ def force_unicode(s, encoding='utf-8', strings_only=False, errors='strict'):
|
||||
# working unicode method. Try to handle this without raising a
|
||||
# further exception by individually forcing the exception args
|
||||
# to unicode.
|
||||
s = u' '.join([force_unicode(arg, encoding, strings_only,
|
||||
s = ' '.join([force_unicode(arg, encoding, strings_only,
|
||||
errors) for arg in s])
|
||||
return s
|
||||
|
||||
|
||||
Reference in New Issue
Block a user