Ticket #14765: 14765.diff

File 14765.diff, 1.4 KB (added by FunkyBob, 11 years ago)

Simplified patch that passes all tests on current master.

  • django/template/defaulttags.py

    diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
    index 921a359..f1820c8 100644
    a b from django.template.base import (Node, NodeList, Template, Context, Library,  
    1616    render_value_in_context)
    1717from django.template.smartif import IfParser, Literal
    1818from django.template.defaultfilters import date
    19 from django.utils.encoding import smart_text
     19from django.utils.encoding import smart_text, force_unicode
    2020from django.utils.safestring import mark_safe
    2121from django.utils.html import format_html
    2222from django.utils import six
    class ForNode(Node):  
    154154            len_values = len(values)
    155155            if len_values < 1:
    156156                return self.nodelist_empty.render(context)
    157             nodelist = NodeList()
     157            nodelist = []
    158158            if self.is_reversed:
    159159                values = reversed(values)
    160160            unpack = len(self.loopvars) > 1
    class ForNode(Node):  
    205205                    # don't want to leave any vars from the previous loop on the
    206206                    # context.
    207207                    context.pop()
    208         return nodelist.render(context)
     208        return mark_safe(''.join([force_unicode(n) for n in nodelist]))
    209209
    210210class IfChangedNode(Node):
    211211    child_nodelists = ('nodelist_true', 'nodelist_false')
Back to Top