def render(self, filename, context): # print "xxx TvizREnderer: " + filename try: templatetxt = open(template_file(filename), 'r').read() except Exception as e: logging.error("HtmlRenderer: Error reading: " + filename) raise e try: outputhtml = template.render(content= templatetxt, context = context) except Exception as e: logging.error("HtmlRenderer: Error rendering: " + filename) raise e outfile = html_file('tanda.html') try: out = codecs.open(outfile, 'w') out.write(outputhtml) out.close() except: logging.error("HtmlRenderer: Error writing to file: " + outfile)
def open_browser(self): webbrowser.open(html_file('index.html'), new=0, autoraise=True)
def __init__(self): copy(template_file('main.css'), html_file('main.css')) copy(template_file('index.html'), html_file('index.html'))