Handle unkown variables when rendering template

This commit is contained in:
shortcutme 2019-11-19 01:38:22 +01:00
parent 5c27a0efcc
commit 08574bf676
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -318,7 +318,10 @@ class UiRequest(object):
template = open(template_path, encoding="utf8").read()
def renderReplacer(m):
if m.group(1) in kwargs:
return "%s" % kwargs.get(m.group(1), "")
else:
return m.group(0)
template_rendered = re.sub("{(.*?)}", renderReplacer, template)