Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for galaxy.tools.error_reports.plugins.email

"""The module describes the ``email`` error plugin."""

import logging

from galaxy.tools.errors import EmailErrorReporter
from galaxy.util import (
    string_as_bool,
    unicodify,
)
from . import ErrorPlugin

log = logging.getLogger(__name__)


[docs]class EmailPlugin(ErrorPlugin): """Send error report as an email """ plugin_type = "email"
[docs] def __init__(self, **kwargs): self.app = kwargs['app'] self.redact_user_details_in_bugreport = self.app.config.redact_user_details_in_bugreport self.verbose = string_as_bool(kwargs.get('verbose', True)) self.user_submission = string_as_bool(kwargs.get('user_submission', True))
[docs] def submit_report(self, dataset, job, tool, **kwargs): """Send report as an email """ try: error_reporter = EmailErrorReporter(dataset.id, self.app) error_reporter.send_report(user=job.get_user(), email=kwargs.get('email', None), message=kwargs.get('message', None), redact_user_details_in_bugreport=self.redact_user_details_in_bugreport) return ("Your error report has been sent", "success") except Exception as e: return (f"An error occurred sending the report by email: {unicodify(e)}", "danger")
__all__ = ('EmailPlugin', )