示例#1
0
    def write(self, pagetype, data, output, style="scry"):
        from ezt import Template

        # FIXME: Great error handling
        styles = ["scry", "james"]
        pageTypes = {"photo": "_photo_per_page.ezt", "index": "_gallery_index.ezt", "main": "_main_index.ezt"}

        # FIXME:
        if not style in styles:
            raise TemplateError, "%s is not a supported style" % style

        css_content = open(join(self.styleDir, style + ".css")).read()
        data["css_content"] = css_content

        template = join(self.templateDir, style + pageTypes[pagetype])
        pytofTemplate = Template(template)
        wfile = open(output, "w")
        pytofTemplate.generate(wfile, data)
示例#2
0
 def _testTemplate(self, template, data, output = ''):
     if not output:
         output = self.pytofOutput
     pytofTemplate = Template(template)
     wfile = open(output, 'w')
     pytofTemplate.generate(wfile, data)