Jinja: Allowing block overrides in include tags causes unexpected behavior.

Created on 10 Jun 2013  ·  5Comments  ·  Source: pallets/jinja

Most helpful comment

It should be such easy to provide include with block overrides while keeping compatibility of current implementation of include just by using different template tag name:

{% include 'file.jinja2' %}

does not override included blocks, while:

{% include_override 'file.jinja2' %}

does the same.

It's very strange that such functionality is not implemented for such a long time, knowing how Jinja2 is very powerful in most of features, in fact one of the best template engines around, not just for Python.

Especially if there was actual patch done already.

All 5 comments

Reverted, going to be in next maintenance release.

Was this ever fixed? I am still experiencing this bug (same as #169 and #84).

The bug still exists.

This bug was fixed. Originally #84 introduced block overrides in include tags and got merged later, but it has since broke some templates setup (recursion on duplicated block), hence this issue.

Because the template behavior should not be changed, @mitsuhiko revert the patch.

If you want to support block overrides, please make a new issue, and maybe a proposed working solution.

It should be such easy to provide include with block overrides while keeping compatibility of current implementation of include just by using different template tag name:

{% include 'file.jinja2' %}

does not override included blocks, while:

{% include_override 'file.jinja2' %}

does the same.

It's very strange that such functionality is not implemented for such a long time, knowing how Jinja2 is very powerful in most of features, in fact one of the best template engines around, not just for Python.

Especially if there was actual patch done already.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

galaxy4public picture galaxy4public  ·  9Comments

chuwy picture chuwy  ·  21Comments

FreddieChopin picture FreddieChopin  ·  9Comments

gaborbernat picture gaborbernat  ·  18Comments

dwt picture dwt  ·  9Comments