Skip to content

Allow to use keyword arguments in plugins called within a template #559

@edvgui

Description

@edvgui

Consider the following model

std::print(std::template("/ip.j2", net="192.168.0.0/24"))

and the following template:

{{ net | std.ipindex(1, keep_prefix=true) }}

The compiler will fail with the given exception:

TypeError: _get_template_engine.<locals>.curywrapper.<locals>.safewrapper() got an unexpected keyword argument 'keep_prefix'

It should be possible to call these plugins this way. The config module already does it, this is a workaround to the original model:

std::print(config::get_template_value_as_string({"path": "template:///ip.j2}", "path", net="192.168.0.0/24"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    compilerenhancementNew feature or requestusabilityThis ticket is related to improved usability

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions