1
0
mirror of https://github.com/django/django.git synced 2025-07-04 01:39:20 +00:00

unicode: Fixed #4495 -- Fixed a used of str() in the "firstof" template tag.

Patch from Ivan Sagalaev.


git-svn-id: http://code.djangoproject.com/svn/django/branches/unicode@5446 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2007-06-09 14:34:14 +00:00
parent b43ecd823c
commit 322c3e1454

View File

@ -4,7 +4,7 @@ from django.template import Node, NodeList, Template, Context, resolve_variable
from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END from django.template import TemplateSyntaxError, VariableDoesNotExist, BLOCK_TAG_START, BLOCK_TAG_END, VARIABLE_TAG_START, VARIABLE_TAG_END, SINGLE_BRACE_START, SINGLE_BRACE_END, COMMENT_TAG_START, COMMENT_TAG_END
from django.template import get_library, Library, InvalidTemplateLibrary from django.template import get_library, Library, InvalidTemplateLibrary
from django.conf import settings from django.conf import settings
from django.utils.encoding import smart_str from django.utils.encoding import smart_str, smart_unicode
import sys import sys
import re import re
@ -59,8 +59,8 @@ class FirstOfNode(Node):
except VariableDoesNotExist: except VariableDoesNotExist:
continue continue
if value: if value:
return str(value) return smart_unicode(value)
return '' return u''
class ForNode(Node): class ForNode(Node):
def __init__(self, loopvars, sequence, reversed, nodelist_loop): def __init__(self, loopvars, sequence, reversed, nodelist_loop):