Exemplo n.º 1
0
 def __init__(self, download_folder = "cyginstall",
              port = 8888,
              num_threads = constants.DEFAULT_NUM_THREADS):
     self.port = port
     self.server = CygwinHTTPServer(("", port), CygwinHandler)
     self.server.initialise("/static/",
                            utils.get_file_from_server("static"),
                            CygwinContext(download_folder, num_threads))
Exemplo n.º 2
0
    def serve_template(self, template_file, values = {}):
        """
        Renders and serves the resulting template.
        """
        self.send_response(200)
        self.send_header('Content-type', "text/html")
        self.end_headers()

        from jinja2 import Template
        template = Template(open(utils.get_file_from_server(template_file)).read())
        rendered = template.render(**values)
        self.wfile.write(rendered)