From 1280d9ba33c386eed2e9a4d644fb16e34519d7a0 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Wed, 5 Jul 2023 16:30:50 +0800 Subject: [PATCH] bugfix --- appPublic/myTE.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/appPublic/myTE.py b/appPublic/myTE.py index 076b75a..a3fcb80 100755 --- a/appPublic/myTE.py +++ b/appPublic/myTE.py @@ -68,3 +68,15 @@ class MyTemplateEngine: with codecs.open(jsonfile,"r",self.file_coding) as f: data = json.load(f) return self.render(tmplfile,data) + +def tmpTml(f, ns): + te = MyTemplateEngine('.') + with codecs.open(f, 'r', 'utf-8') as fd: + d = fd.read() + b = te.renders(d, ns) + filename = os.path.basename(f) + p = f'/tmp/{filename}' + with codecs.open(p, 'w', 'utf-8') as wf: + wf.write(b) + return p +