arguments

The arguments variable is a tuple of the arguments the macro accepts. These are the explicitly defined arguments, not the special kwargs or varargs. Our previous example would have rendered an empty tuple (), so let's modify it to get something else:

{% macro test(var_a='a string') -%} 
{{ test.arguments }} 
{%- endmacro -%} 
{{ test() }} 

Rendering this template will result in the following output:

In this example, we can clearly see that our template rendered with the name of the arguments that the macro accepts (and not their values).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.179.225