rattail.reporting.handlers

Report Handlers

class rattail.reporting.handlers.ReportHandler(config=None, **kwargs)[source]

Base class for all report handlers. Also provides default implementation, which is assumed to be sufficient for most needs.

email_output(report, output, mailkey, fallback_mailkey='common_report', extra_data={}, **kwargs)[source]

Send an email (using the given mailkey) with the report output as an attachment.

Parameters:
  • report – The relevant Report instance.

  • output – The relevant ReportOutput instance.

  • mailkey – Config key which identifies the type of email to be sent.

  • fallback_mailkey – Config key to be used as fallback, should the mailkey not point to a valid email config.

  • extra_data – Additional context data to be passed along to the email template.

  • kwargs – Additional kwargs to be passed directly to send_email().

generate_output(session, report, params, user, progress=None, **kwargs)[source]

Generate and return output for the given report and params.

get_report(key)[source]

Fetch a report by key. If the report can be located, this will return an instance thereof; otherwise returns None.

get_reports()[source]

Returns a dict of all available reports, keyed by the report type key.

By default this includes all reports which are properly registered via setuptools entry points. It also will include any custom Poser reports, although that can be disabled via config if desired.

rattail.reporting.handlers.get_report_handler(config, **kwargs)[source]

Create and return the configured ReportHandler instance.