diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-06-16 20:24:44 +0200 |
|---|---|---|
| committer | Christian Breunig <christian@breunig.cc> | 2026-06-16 20:24:44 +0200 |
| commit | 51e6b967b1216853c2bd3bc3298639bd3382b5bc (patch) | |
| tree | e119cd4c862132a6b6f73b2ed8eeeb069bdfc049 /python | |
| parent | 132133e9be4289b44e14393d39225a42eea6f34b (diff) | |
| download | vyos-1x-51e6b967b1216853c2bd3bc3298639bd3382b5bc.tar.gz vyos-1x-51e6b967b1216853c2bd3bc3298639bd3382b5bc.zip | |
template: T8923: fix typo in function argument "formater" -> "formatter"
Diffstat (limited to 'python')
| -rwxr-xr-x | python/vyos/template.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/python/vyos/template.py b/python/vyos/template.py index 9d309370e..8a624d989 100755 --- a/python/vyos/template.py +++ b/python/vyos/template.py @@ -124,12 +124,12 @@ def register_clever_function(name, func=None): _CLEVER_FUNCTIONS[name] = func return func -def render_to_string(template, content, formater=None, location=None): +def render_to_string(template, content, formatter=None, location=None): """Render a template from the template directory, raise on any errors. :param template: the path to the template relative to the template folder :param content: the dictionary of variables to put into rendering context - :param formater: + :param formatter: if given, it has to be a callable the rendered string is passed through The parsed template files are cached, so rendering the same file multiple times @@ -141,8 +141,8 @@ def render_to_string(template, content, formater=None, location=None): """ template = _get_environment(location).get_template(template) rendered = template.render(content) - if formater is not None: - rendered = formater(rendered) + if formatter is not None: + rendered = formatter(rendered) return rendered @@ -150,7 +150,7 @@ def render( destination, template, content, - formater=None, + formatter=None, permission=None, user=None, group=None, @@ -171,7 +171,7 @@ def render( # As we are opening the file with 'w', we are performing the rendering before # calling open() to not accidentally erase the file if rendering fails - rendered = render_to_string(template, content, formater, location) + rendered = render_to_string(template, content, formatter, location) # Remove any trailing character and always add a new line at the end rendered = rendered.rstrip() + "\n" |
