common case that gets copy pasted around. To not completely break backwards
compatibility with the most common cases it's now possible to provide an
explicit keyword argument for caller if it's given an explicit default.
+- Restored the use of blocks in macros to the extend that was possible
+ before. On Python 3 it would render a generator repr instead of
+ the block contents. (#645)
Version 2.9.1
-------------
context = node.scoped and (
'context.derived(%s)' % self.dump_local_context(frame)) or 'context'
- if supports_yield_from and not self.environment.is_async:
+ if supports_yield_from and not self.environment.is_async and \
+ frame.buffer is None:
self.writeline('yield from context.blocks[%r][0](%s)' % (
node.name, context), node)
else:
t.module.x(None, caller=lambda: 42)
assert exc_info.match(r'\'x\' was invoked with two values for the '
r'special caller argument')
+
+ def test_macro_blocks(self, env):
+ t = env.from_string('{% macro x() %}{% block foo %}x{% '
+ 'endblock %}{% endmacro %}{{ x() }}')
+ assert t.render() == 'x'