From 3c72e38b11b4c1a3da5b65ff022571c3d18779c1 Mon Sep 17 00:00:00 2001 From: alploskov <59963354+aleksey-satir@users.noreply.github.com> Date: Sat, 6 Aug 2022 06:14:32 +0300 Subject: [PATCH] core: fixed an error when loading templates --- kithon/core.py | 4 +++- kithon/node.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kithon/core.py b/kithon/core.py index 3c3889e..269cd2f 100644 --- a/kithon/core.py +++ b/kithon/core.py @@ -144,10 +144,12 @@ def add_templ(self, name, template): elif isinstance(template, dict): for field, value in template.items(): keywords = [ - 'tmp', 'type', 'import_code', + 'type', 'import_code', 'code', 'alt_name', 'ret_type', 'meta', 'decorate', 'args' ] + if field == 'tmp': + self.templates[name].update({'tmp': Template(value)}) if field in keywords: self.templates[name].update({field: value}) else: diff --git a/kithon/node.py b/kithon/node.py index 562ede0..8ccdbd0 100644 --- a/kithon/node.py +++ b/kithon/node.py @@ -31,7 +31,7 @@ def __init__(self, env=None, tmp=None, name=None, parts=None, type=None, nl=1, o self.tmp = env.templates[tmp].get('tmp', '') else: self.name = name or 'unknown' - self.tmp = Template(tmp) + self.tmp = Template(tmp or '') self.parts = parts self.type = type or 'None' self.env = env