configd/templates, add decode_idna and encode_idna to template parser, see https://github.com/opnsense/core/pull/2327

This commit is contained in:
Ad Schellevis 2018-04-15 16:29:50 +02:00
parent 075a0b7a4a
commit cf3ebcae01

View File

@ -60,6 +60,10 @@ class Template(object):
self._j2_env = jinja2.Environment(loader=jinja2.FileSystemLoader(self._template_dir), trim_blocks=True,
extensions=["jinja2.ext.do", "jinja2.ext.loopcontrols"])
# register additional filters
self._j2_env.filters['decode_idna'] = lambda x:x.decode('idna')
self._j2_env.filters['encode_idna'] = lambda x:x.encode('idna')
def list_module(self, module_name):
""" list single module content
:param module_name: module name in dot notation ( company.module )