Commit 661b3ecd by Chris Jerdonek

Fixed an issue with list section values mixing lambdas and non-lambdas.

parent 8bc8baf3
......@@ -208,8 +208,8 @@ class RenderEngine(object):
#
# TODO: should we check the arity?
new_template = element(template)
parsed_template = self._parse(new_template, delimiters=delims)
parts.append(parsed_template.render(context))
new_parsed_template = self._parse(new_template, delimiters=delims)
parts.append(new_parsed_template.render(context))
continue
context.push(element)
......
......@@ -517,6 +517,21 @@ class RenderTests(unittest.TestCase, AssertStringMixin):
self._assert_render(u'<~bar~#bar#>', template, context)
def test_section__lambda__mixed_list(self):
"""
Test a mixed list of lambdas and non-lambdas as a section value.
This test case is equivalent to a test submitted to the Mustache spec here:
https://github.com/mustache/spec/pull/47 .
"""
template = '<{{#lambdas}}foo{{/lambdas}}>'
context = {'foo': 'bar',
'lambdas': [lambda text: "~{{%s}}~" % text, 1]}
self._assert_render(u'<~bar~foo>', template, context)
def test_section__lambda__not_on_context_stack(self):
"""
Check that section lambdas are not pushed onto the context stack.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment