def __call__(self, request): path = self.__get_filesystem_path(request) if path == None or not os.path.isfile(path): return pywy.core.Response(pywy.codes.NOT_FOUND) mimetype, encoding = self.mimedb.guess_type(path) if not mimetype: mimetype = "application/octet-stream" response = pywy.core.Response() response.add_header("Content-Type", mimetype) with open(path) as f: response.write(f.read()) return response
def __call__(self, request): response = pywy.response.HtmlResponse() response.write(request.application.template.render("index.html", *self.args, **self.kwargs)) return response