diff options
| author | Tim Graham <timograham@gmail.com> | 2013-08-28 09:48:47 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2013-08-28 09:48:47 -0400 |
| commit | 12023887ea3e495e070b1f624078612776edf9be (patch) | |
| tree | a236de70eab93e9ac4eb1c629064d987cc3db00f | |
| parent | da800be6ddfdd4c88b48011ef264ea1ec6365725 (diff) | |
Fixed #14765 -- Removed unncessary usage of NodeList in ForNode.
Thanks traff and FunkyBob for work on the patch.
| -rw-r--r-- | django/template/defaulttags.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 921a3594cc..2a3af9b1eb 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -16,7 +16,7 @@ from django.template.base import (Node, NodeList, Template, Context, Library, render_value_in_context) from django.template.smartif import IfParser, Literal from django.template.defaultfilters import date -from django.utils.encoding import smart_text +from django.utils.encoding import force_text, smart_text from django.utils.safestring import mark_safe from django.utils.html import format_html from django.utils import six @@ -154,7 +154,7 @@ class ForNode(Node): len_values = len(values) if len_values < 1: return self.nodelist_empty.render(context) - nodelist = NodeList() + nodelist = [] if self.is_reversed: values = reversed(values) unpack = len(self.loopvars) > 1 @@ -205,7 +205,7 @@ class ForNode(Node): # don't want to leave any vars from the previous loop on the # context. context.pop() - return nodelist.render(context) + return mark_safe(''.join([force_text(n) for n in nodelist])) class IfChangedNode(Node): child_nodelists = ('nodelist_true', 'nodelist_false') |
