I have base template that contains macro like this
{%- macro local_vars(d) -%}
{%- block local_vars %}
{% endblock -%}
{%- endmacro -%}
So I would like to override this block in the child template and still use the variable "d" from the base template. I tried this:
{%- block local_vars -%}
{{d.out.type}} {{d.component_name}}_out;
{%- endblock -%}
, but I get error:
UndefinedError: 'd' is undefined.
I also tried to create the new variable inside the block in the base template, and access it with {{super}}:
base:
{%- macro local_vars(d) -%}
{%- block local_vars %}
{% set dict = d%}
{% endblock -%}
{%- endmacro -%}
child:
{%- block local_vars -%}
{{super}}
{{dict.out.type}} {{dict.component_name}}_out;
}
{%- endblock -%}
, but this doesn't work either. I only get the new error:
UndefinedError: 'function object' has no attribute 'out'
I haven't used blocks before, so any help would be highly appreciated. If there is a way to pass the variable to the block in child template, that would be the most painless solution for me, but I'm opened for suggestions.
Thanks in advance.