Allow to use keyword arguments in plugins called within a template
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 0
- Forks
- 6
- Avg merge
- 12h 25m
- Merged PRs (30d)
- 5
Description
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"))
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the std::template call and the template plugin invocation shown in the report, then compare their keyword-argument handling with config::get_template_value_as_string, which already supports the workaround. Reproduce the failure using std.ipindex(1, keep_prefix=true); done means keyword arguments work for plugins called within a template without the unexpected-keyword exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100