Example #1
0
    def test_00_template_compile(self):
        template_path = os.path.join(selfdir(), "template_example_00.tmpl")

        c0 = TT.compile(template_path, {})
        c1 = TT.compile(template_path, {"title": "pyTenjin tests: context", })

        # TBD:
        self.assertTrue(bool(c0))
        self.assertTrue(bool(c1))
Example #2
0
    def genfile(self, template, output):
        """
        Generate file in workdir from given template.

        :param template:  Template file path relative to search dirs
        :param output:  Output file path relative to workdir
        """
        out = os.path.join(self.workdir, output)
        content = T.compile(template, self.pkgdata, self.template_paths,
                            ask=True)
        open(out, "w").write(content)  # may throw IOError, OSError.