Skip to content

Commit

Permalink
Revert "Support included blocks override"
Browse files Browse the repository at this point in the history
This reverts commit 33aee12.

This fixes #243.
  • Loading branch information
mitsuhiko committed Aug 7, 2013
1 parent 3d82fc3 commit 59713a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
11 changes: 2 additions & 9 deletions jinja2/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -949,16 +949,9 @@ def visit_Include(self, node, frame):
self.indent()

if node.with_context:
self.writeline('include_context = template.new_context('
'context.parent, True, locals())')
self.writeline('for name, context_blocks in context.'
'blocks.%s():' % dict_item_iter)
self.indent()
self.writeline('include_context.blocks.setdefault('
'name, [])[0:0] = context_blocks')
self.outdent()
self.writeline('for event in template.root_render_func('
'include_context):')
'template.new_context(context.parent, True, '
'locals())):')
else:
self.writeline('for event in template.module._body_stream:')

Expand Down
16 changes: 0 additions & 16 deletions jinja2/testsuite/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,22 +121,6 @@ def test_context_include_with_overrides(self):
)))
assert env.get_template("main").render() == "123"

def test_included_block_override(self):
env = Environment(loader=DictLoader(dict(
main="{% extends 'base' %}{% block b %}1337{% endblock %}",
base="{% include 'inc' %}",
inc="{% block b %}42{% endblock %}"
)))
assert env.get_template("main").render() == "1337"

def test_included_block_override_with_super(self):
env = Environment(loader=DictLoader(dict(
main="{% extends 'base' %}{% block b %}1337|{{ super() }}{% endblock %}",
base="{% include 'inc' %}",
inc="{% block b %}42{% endblock %}"
)))
assert env.get_template("main").render() == "1337|42"

def test_unoptimized_scopes(self):
t = test_env.from_string("""
{% macro outer(o) %}
Expand Down

0 comments on commit 59713a3

Please sign in to comment.