mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-20 03:16:12 +00:00
jinja2: add regex_replace, pull in https://github.com/opnsense/core/pull/4225 using lambda
This commit is contained in:
parent
c9f2094200
commit
71e1393b73
@ -32,6 +32,7 @@
|
||||
import os
|
||||
import os.path
|
||||
import glob
|
||||
import re
|
||||
import stat
|
||||
import syslog
|
||||
import collections
|
||||
@ -63,6 +64,7 @@ class Template(object):
|
||||
# register additional filters
|
||||
self._j2_env.filters['decode_idna'] = lambda x:x.decode('idna')
|
||||
self._j2_env.filters['encode_idna'] = self._encode_idna
|
||||
self._j2_env.filters['regex_replace'] = lambda value, pattern, replacement: re.sub(pattern, replacement, value)
|
||||
|
||||
@staticmethod
|
||||
def _encode_idna(x):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user