Skip to content
Myr

Merge branch '2.9-maintenance'

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parents 62d72ee, b1a56de · Browse files · 3 files+13 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+13 added−3 removed

  • tests:+5 added−0 removed
  • other:+8 added−3 removed

3 files+13 added−3 removed

modified:jinja2/runtime.py+5 added-3 removed
212 unmodified lines
213 'a callable raised a '214 'StopIteration exception')215216 def derived(self, locals=None):217 """Internal helper function to create a derived context."""217 """Internal helper function to create a derived context. This is218 used in situations where the system needs a new context in the same219 template that is independent.220 """221 context = new_context(self.environment, self.name, {},219 self.parent, True, None, locals)220 context.vars.update(self.vars)222 self.get_all(), True, None, locals)223 context.eval_ctx = self.eval_ctx224 context.blocks.update((k, list(v)) for k, v in iteritems(self.blocks))225 return context226
507 unmodified lines
modified:tests/test_regression.py+5 added
445 unmodified lines
446 def test_macro_blocks(self, env):447 t = env.from_string('{% macro x() %}{% block foo %}x{% '448 'endblock %}{% endmacro %}{{ x() }}')449 assert t.render() == 'x'450451 def test_scoped_block(self, env):452 t = env.from_string('{% set x = 1 %}{% with x = 2 %}{% block y scoped %}'453 '{{ x }}{% endblock %}{% endwith %}')454 assert t.render() == '2'
modified:CHANGES+3 added
11 unmodified lines
12 when the variable is also read from an outer scope. This now sets the13 intended behavior in all situations however it does not restore the14 old behavior where limited assignments to outer scopes was possible.15 For more information and a discussion see #64116- Resolved an issue where `block scoped` would not take advantage of the17 new scoping rules. In some more exotic cases a variable overriden in a18 local scope would not make it into a block.1920Version 2.9.221-------------22(bugfix release, released on January 8th 2017)
447 unmodified lines