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

mitsuhiko picture mitsuhiko  路  3Comments

delroth picture delroth  路  4Comments

guettli picture guettli  路  5Comments

hvnsweeting picture hvnsweeting  路  4Comments

Yannik picture Yannik  路  4Comments