From c5ef65bcf324f4c90b53be90f4aec069a68e8c59 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Sat, 21 Jul 2012 10:00:10 +0200 Subject: [py3] Ported django.utils.encoding. * Renamed smart_unicode to smart_text (but kept the old name under Python 2 for backwards compatibility). * Renamed smart_str to smart_bytes. * Re-introduced smart_str as an alias for smart_text under Python 3 and smart_bytes under Python 2 (which is backwards compatible). Thus smart_str always returns a str objects. * Used the new smart_str in a few places where both Python 2 and 3 want a str. --- django/template/debug.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'django/template/debug.py') diff --git a/django/template/debug.py b/django/template/debug.py index 61674034d6..c7ac007b48 100644 --- a/django/template/debug.py +++ b/django/template/debug.py @@ -1,5 +1,5 @@ from django.template.base import Lexer, Parser, tag_re, NodeList, VariableNode, TemplateSyntaxError -from django.utils.encoding import force_unicode +from django.utils.encoding import force_text from django.utils.html import escape from django.utils.safestring import SafeData, EscapeData from django.utils.formats import localize @@ -84,7 +84,7 @@ class DebugVariableNode(VariableNode): output = self.filter_expression.resolve(context) output = template_localtime(output, use_tz=context.use_tz) output = localize(output, use_l10n=context.use_l10n) - output = force_unicode(output) + output = force_text(output) except UnicodeDecodeError: return '' except Exception as e: -- cgit v1.3