bugfix
This commit is contained in:
parent
eb6f94529d
commit
05e2a58fff
@ -82,3 +82,17 @@ def tmpTml(f, ns):
|
|||||||
wf.write(b)
|
wf.write(b)
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
import sys
|
||||||
|
import json
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
print(f'{sys.argv[0]} tmplfile jsonfile')
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
te = MyTemplateEngine('.')
|
||||||
|
with codecs.open(sys.argv[1], 'r', 'utf-8') as f:
|
||||||
|
tmpl = f.read()
|
||||||
|
with codecs.open(sys.argv[2], 'r', 'utf-8') as f1:
|
||||||
|
ns = json.loads(f1.read())
|
||||||
|
print(te.renders(tmpl, ns))
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ class SSHNode:
|
|||||||
self.conn = await self._connect(**j)
|
self.conn = await self._connect(**j)
|
||||||
|
|
||||||
@asynccontextmanager
|
@asynccontextmanager
|
||||||
async def getconnector(self):
|
async def get_connector(self):
|
||||||
refconn = None
|
refconn = None
|
||||||
for jj in self.jumpers:
|
for jj in self.jumpers:
|
||||||
j = jj.copy()
|
j = jj.copy()
|
||||||
|
4
test/test.json
Normal file
4
test/test.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"user":"John",
|
||||||
|
"who":"Thomas"
|
||||||
|
}
|
2
test/test.tmpl
Normal file
2
test/test.tmpl
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
this is a {{user}}'s documents
|
||||||
|
{{who}} want it
|
Loading…
Reference in New Issue
Block a user