def sendWebPage(self, webpage): content = webpage.getHtml('UTF-8') content_type = 'text/html' content_length = len(content) self.send_response(200) self.send_header("Content-type", content_type) self.send_header("Content-Length", content_length) self.end_headers() self.wfile.write(content)
def sendError(self, code, title, message): webpage = page_factory.buildErrorPage(title, message) content = webpage.getHtml('UTF-8') content_type = 'text/html' content_length = len(content) self.send_response(code) self.send_header("Content-type", content_type) self.send_header("Content-Length", content_length) self.end_headers() self.wfile.write(content)