How to use the relatorio.reporting function in relatorio

To help you get started, we’ve selected a few relatorio examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tryton / trytond / trytond / report / report.py View on Github external
def render(cls, report, report_context):
        "calls the underlying templating engine to renders the report"
        fd, path = cls._prepare_template_file(report)

        mimetype = MIMETYPES[report.template_extension]
        rel_report = relatorio.reporting.Report(path, mimetype,
                ReportFactory(), relatorio.reporting.MIMETemplateLoader())
        if report.translatable:
            cls._add_translation_hook(rel_report, report_context)
        else:
            report_context['set_lang'] = lambda language: None

        data = rel_report(**report_context).render()
        if hasattr(data, 'getvalue'):
            data = data.getvalue()
        os.close(fd)
        os.remove(path)

        return data

relatorio

A templating library able to output odt and pdf files

GPL-3.0
Latest version published 7 days ago

Package Health Score

64 / 100
Full package analysis

Similar packages