If the template has an extends tag, the following error is raised by pongo2: "The 'extends' tag can only defined on root level.". That is, the extends tag cannot be placed within an autoescape tag. So, the way this code is structured, one may not use template inheritance with the autoescape option set to false.
I'm not sure of the most ergonomic way to fix this. It could be that one's best option is to turn autoescaping "on" and then to turn it off within the template. E.g.
The way the
autoescape
tag is used wraps the whole template in an{% autoescape off %}
when autoescaping is disabled.https://github.com/wrouesnel/p2cli/blob/a6e63265d9c918d7ec83c442b131a1d8b00796c8/p2cli.go#L235
If the template has an
extends
tag, the following error is raised by pongo2: "The 'extends' tag can only defined on root level.". That is, theextends
tag cannot be placed within anautoescape
tag. So, the way this code is structured, one may not use template inheritance with the autoescape option set to false.I'm not sure of the most ergonomic way to fix this. It could be that one's best option is to turn autoescaping "on" and then to turn it off within the template. E.g.
where
templateB.j2
has contentAnd
templateA.j2
has contentI found this behavior using p2cli to template SQL files using inheritance.