diff frontends/src/jp/output_template.py @ 2248:a81261cee29b

jp (output/template): initialize template rendered only if a rendering is actually needed
author Goffi <goffi@goffi.org>
date Sun, 21 May 2017 15:52:23 +0200
parents 4ec72927a222
children 18d71226b3a8
line wrap: on
line diff
--- a/frontends/src/jp/output_template.py	Sun May 21 15:47:53 2017 +0200
+++ b/frontends/src/jp/output_template.py	Sun May 21 15:52:23 2017 +0200
@@ -37,7 +37,6 @@
     def __init__(self, jp):
         self.host = jp
         jp.register_output(C.OUTPUT_COMPLEX, TEMPLATE, self.render)
-        self.renderer = template.Renderer(jp)
 
     def render(self, data):
         """render output data using requested template
@@ -49,6 +48,7 @@
             command's template_data_mapping attribute will be used if it exists to convert
             data to a dict usable by the template.
         """
+        self.renderer = template.Renderer(self.host)
         cmd = self.host.command
         options = self.host.parse_output_options()
         self.host.check_output_options(OPTIONS, options)