コード例 #1
0
ファイル: engine.py プロジェクト: abhaygupta97/moban
 def _render_with_finding_template_first(self, template_file_index):
     for (template_file, data_output_pairs) in template_file_index.items():
         template = self.jj2_environment.get_template(template_file)
         for (data_file, output) in data_output_pairs:
             data = self.context.get_data(data_file)
             flag = self._apply_template(template, data, output)
             if flag:
                 reporter.report_templating(template_file, output)
                 self.__templated_count += 1
             self.__file_count += 1
コード例 #2
0
 def render_string_to_file(self, template_in_string, data_file,
                           output_file):
     self.file_count = 1
     template = self.engine.get_template_from_string(template_in_string)
     template_abs_path = template_in_string[:10] + "..."
     data = self.context.get_data(data_file)
     flag = self.apply_template(template_abs_path, template, data,
                                output_file)
     if flag:
         reporter.report_templating(template_abs_path, output_file)
         self.templated_count += 1
コード例 #3
0
    def render_to_file(self, template_file, data_file, output_file):
        self.file_count = 1
        data = self.context.get_data(data_file)
        template = self.engine.get_template(template_file)
        template_abs_path = utils.get_template_path(self.template_dirs,
                                                    template_file)

        flag = self.apply_template(template_abs_path, template, data,
                                   output_file)
        if flag:
            reporter.report_templating(template_file, output_file)
            self.templated_count += 1
コード例 #4
0
ファイル: plugins.py プロジェクト: seeeturtle/moban
 def _render_with_finding_data_first(self, data_file_index):
     for (data_file, template_output_pairs) in data_file_index.items():
         data = self.context.get_data(data_file)
         for (template_file, output) in template_output_pairs:
             template = self.engine.get_template(template_file)
             template_abs_path = utils.get_template_path(
                 self.template_dirs, template_file)
             flag = self.apply_template(template_abs_path, template, data,
                                        output)
             if flag:
                 reporter.report_templating(template_file, output)
                 self.templated_count += 1
             self.file_count += 1
コード例 #5
0
def test_report_templating():
    patcher = patch("sys.stdout", new_callable=StringIO)
    fake_stdout = patcher.start()
    reporter.report_templating("a", "b")
    patcher.stop()
    eq_(fake_stdout.getvalue(), "Templating a to b\n")