MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / serve_file

Method serve_file

utils.py:332–343  ·  view source on GitHub ↗
(self, handler, filename)

Source from the content-addressed store, hash-verified

330 return html
331
332 def serve_file(self, handler, filename):
333 try:
334 with open(os.path.join(self.shared_data.webdir, filename), 'r', encoding='utf-8') as file:
335 content = file.read()
336 content = content.replace('{{ web_delay }}', str(self.shared_data.web_delay * 1000))
337 handler.send_response(200)
338 handler.send_header("Content-type", "text/html")
339 handler.end_headers()
340 handler.wfile.write(content.encode('utf-8'))
341 except FileNotFoundError:
342 handler.send_response(404)
343 handler.end_headers()
344
345 def serve_current_config(self, handler):
346 handler.send_response(200)

Callers

nothing calls this directly

Calls 3

readMethod · 0.45
writeMethod · 0.45
encodeMethod · 0.45

Tested by

no test coverage detected