mirror of
https://github.com/isc-projects/bind9.git
synced 2026-07-15 14:10:48 -04:00
Allow instantiating template dataclasses in jinja2 templates
In some cases, the template data might need to be set directly in the
jinja2 templates using `{% set %}`. Expose the template dataclasses to
the templates so we can use these existing classes, rather than creating
ad-hoc data containers.
(cherry picked from commit dddb067351)
This commit is contained in:
parent
6e31e36a0e
commit
8cda065d49
1 changed files with 5 additions and 0 deletions
|
|
@ -45,6 +45,11 @@ class TemplateEngine:
|
|||
variable_start_string="@",
|
||||
variable_end_string="@",
|
||||
)
|
||||
# allow instantiating the template dataclasses in jinja2 templates when
|
||||
# using {% set %}
|
||||
self.j2env.globals["Nameserver"] = Nameserver
|
||||
self.j2env.globals["TrustAnchor"] = TrustAnchor
|
||||
self.j2env.globals["Zone"] = Zone
|
||||
|
||||
def render(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Reference in a new issue