diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2011-10-11 20:43:11 +0000 |
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2011-10-11 20:43:11 +0000 |
| commit | 3e940cdfd964bc37b1868b53a346308f66f995c1 (patch) | |
| tree | d11783ad331d9062680cab0660905d5ccc45dac1 | |
| parent | a71bd3e0c99fec895cd2aea9ca0be228449bc2fc (diff) | |
Simplify some code to have one loop, rather than two.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16959 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/template/base.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/template/base.py b/django/template/base.py index 86ba0301b8..8001e93d5f 100644 --- a/django/template/base.py +++ b/django/template/base.py @@ -814,10 +814,11 @@ class NodeList(list): bits = [] for node in self: if isinstance(node, Node): - bits.append(self.render_node(node, context)) + bit = self.render_node(node, context) else: - bits.append(node) - return mark_safe(u''.join([force_unicode(b) for b in bits])) + bit = node + bits.append(force_unicode(bit)) + return mark_safe(u''.join(bits)) def get_nodes_by_type(self, nodetype): "Return a list of all nodes of the given type" |
