From f8af22b882f734c3d7dd0bcaf4673552d0a616c4 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 7 Nov 2017 14:38:45 +0100 Subject: more work on wire auditor and reporting (#4958) --- contrib/render.py | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'contrib/render.py') diff --git a/contrib/render.py b/contrib/render.py index d31c7f9bd..093db3559 100755 --- a/contrib/render.py +++ b/contrib/render.py @@ -1,14 +1,19 @@ #!/usr/bin/python # This file is in the public domain. -""" -Expand Jinja2 templates based on JSON input. +"""Expand Jinja2 templates based on JSON input. + +First command-line argument must be the JSON input from taler-auditor. +Second command-line argument must be the JSON input from the +taler-wire-auditor. + +The tool then reads the template from stdin and writes the expanded +output to stdout. -First command-line argument must be the JSON input. -The tool reads the template from stdin and writes -the expanded output to stdout. +TODO: proper installation, man page, error handling, --help option. @author Christian Grothoff + """ import sys @@ -23,10 +28,13 @@ class StdinLoader(BaseLoader): def get_source(self, environment, template): source = sys.stdin.read().decode('utf-8') return source, self.path, lambda: false - -jsonFile = open (sys.argv[1], 'r') -jsonData = json.load(jsonFile) + +jsonFile1 = open (sys.argv[1], 'r') +jsonData1 = json.load(jsonFile) + +jsonFile2 = open (sys.argv[2], 'r') +jsonData2 = json.load(jsonFile) jinjaEnv = jinja2.Environment(loader=StdinLoader(), lstrip_blocks=True, @@ -35,4 +43,4 @@ jinjaEnv = jinja2.Environment(loader=StdinLoader(), autoescape=False) tmpl = jinjaEnv.get_template('stdin'); -print(tmpl.render(data = jsonData)) +print(tmpl.render(data = jsonData1, wire = jsonData2)) -- cgit v1.2.3