async def respond(self, response: Response) -> None: page = self.page proc = self.proc response.setContentType('text/x-csv; charset=UTF-8') response.setFileName(page.getFileName(proc)) sepChar = proc.args.sep.value for row in page.iterRows(proc): response.write(sepChar.join(row) + '\r\n')
async def respond(self, response: Response) -> None: export = self.__export fmt = self.__format response.setContentType(fmt.mediaType) if export: response.setFileName(f'{self.__fileName}.{fmt.ext}') else: response.allowEmbedding() data = self.__builder.build(export).data response.setETag(createETag(data) + b'-dot') try: rendered = await _renderGraph(data, fmt) except Exception as ex: response.setStatus(500, 'Graph rendering failed') response.setContentType('text/plain') response.write(f'Graph rendering failed: {ex}\n') else: response.write(rendered)