def fetch_local_file(self, uri): #fh = open(uri) fh = LocalFileLoader().load(uri) content_type, _ = mimetypes.guess_type(uri) # create fake headers for local file status_headers = StatusAndHeaders('200 OK', [('Content-Type', content_type)]) stream = fh return (status_headers, stream)
def __init__(self, static_path): mimetypes.init() self.static_path = static_path self.block_loader = LocalFileLoader()