commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/45b206f6ab8f/ Changeset: 45b206f6ab8f User: dannon Date: 2014-12-16 00:38:00+00:00 Summary: Provide both user email and preferred contact email (if different) in error report form. Affected #: 1 file diff -r f06ac1a9f76efef1eb1cc174979184a73a01711d -r 45b206f6ab8fc8bf319766368d128f9b0fc6b4d1 lib/galaxy/tools/errors.py --- a/lib/galaxy/tools/errors.py +++ b/lib/galaxy/tools/errors.py @@ -22,7 +22,7 @@ ${history_view_link} ----------------------------------------------------------------------------- -The user '${email}' provided the following information: +The user ${email_str} provided the following information: ${message} ----------------------------------------------------------------------------- @@ -74,12 +74,16 @@ else: roles = [] return self.app.security_agent.can_access_dataset( roles, self.hda.dataset ) - def create_report( self, email='', message='', **kwd ): + def create_report( self, user, email='', message='', **kwd ): hda = self.hda job = self.job host = web.url_for( '/', qualified=True ) history_view_link = web.url_for( controller="history", action="view", id=self.app.security.encode_id( hda.history_id ), qualified=True ) # Build the email message + if user and user.email != email: + email_str = "'%s' (providing preferred contact email '%s')" % (user.email, email) + else: + email_str = "'%s'" % email self.report = string.Template( error_report_template ) \ .safe_substitute( host=host, dataset_id=hda.dataset_id, @@ -97,22 +101,22 @@ job_stdout=util.unicodify( job.stdout ), job_info=util.unicodify( job.info ), job_traceback=util.unicodify( job.traceback ), - email=email, + email_str=email_str, message=util.unicodify( message ) ) def _send_report( self, user, email=None, message=None, **kwd ): return self.report def send_report( self, user, email=None, message=None, **kwd ): if self.report is None: - self.create_report( email=email, message=message, **kwd ) + self.create_report( user, email=email, message=message, **kwd ) return self._send_report( user, email=email, message=message, **kwd ) - + class EmailErrorReporter( ErrorReporter ): def _send_report( self, user, email=None, message=None, **kwd ): smtp_server = self.app.config.smtp_server assert smtp_server, ValueError( "Mail is not configured for this galaxy instance" ) to_address = self.app.config.error_email_to assert to_address, ValueError( "Error reporting has been disabled for this galaxy instance" ) - + frm = to_address # Check email a bit email = email or '' https://bitbucket.org/galaxy/galaxy-central/commits/4f767bb3989f/ Changeset: 4f767bb3989f User: dannon Date: 2014-12-16 00:40:28+00:00 Summary: Pep8 standardized method spacing in lib/galaxy/tools/errors.py Affected #: 1 file diff -r 45b206f6ab8fc8bf319766368d128f9b0fc6b4d1 -r 4f767bb3989f2ee9b7e3fdb47fa4cdf716205fc6 lib/galaxy/tools/errors.py --- a/lib/galaxy/tools/errors.py +++ b/lib/galaxy/tools/errors.py @@ -50,9 +50,10 @@ (This is an automated message). """ + class ErrorReporter( object ): def __init__( self, hda, app ): - # Get the dataset + # Get the dataset sa_session = app.model.context if not isinstance( hda, model.HistoryDatasetAssociation ): hda_id = hda @@ -68,12 +69,14 @@ self.app = app self.tool_id = self.job.tool_id self.report = None + def _can_access_dataset( self, user ): if user: roles = user.all_roles() else: roles = [] return self.app.security_agent.can_access_dataset( roles, self.hda.dataset ) + def create_report( self, user, email='', message='', **kwd ): hda = self.hda job = self.job @@ -103,13 +106,16 @@ job_traceback=util.unicodify( job.traceback ), email_str=email_str, message=util.unicodify( message ) ) + def _send_report( self, user, email=None, message=None, **kwd ): return self.report + def send_report( self, user, email=None, message=None, **kwd ): if self.report is None: self.create_report( user, email=email, message=message, **kwd ) return self._send_report( user, email=email, message=message, **kwd ) + class EmailErrorReporter( ErrorReporter ): def _send_report( self, user, email=None, message=None, **kwd ): smtp_server = self.app.config.smtp_server Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org