| Index: gatekeeper_mailer.py
|
| diff --git a/gatekeeper_mailer.py b/gatekeeper_mailer.py
|
| index 1e1a0525341a2ef7cdb97a6395543f3f2d610550..7f02b6425304914eccb7a40a9a939a3943fdc9e6 100644
|
| --- a/gatekeeper_mailer.py
|
| +++ b/gatekeeper_mailer.py
|
| @@ -27,17 +27,19 @@ Results = ["success", "warnings", "failure", "skipped", "exception", "retry"]
|
| class MailTemplate(object):
|
| """Encapsulates a buildbot status email."""
|
|
|
| - status_header = 'Automatically closing tree for "%(steps)s" on "%(builder)s"'
|
| - default_subject = ('buildbot %(result)s in %(projectName)s on %(builder)s, '
|
| - 'revision %(revision)s')
|
| + default_status_header = ('Automatically closing tree for "%(steps)s" on '
|
| + '"%(builder_name)s"')
|
| + default_subject = ('buildbot %(result)s in %(project_name)s on '
|
| + '%(builder_name)s, revision %(revision)s')
|
|
|
| def __init__(self, waterfall_url, build_url, project_name, fromaddr,
|
| - reply_to=None, subject=None):
|
| + reply_to=None, subject=None, status_header=None):
|
|
|
|
|
| self.reply_to = reply_to
|
| self.fromaddr = fromaddr
|
| self.subject = subject or self.default_subject
|
| + self.status_header = status_header or self.default_status_header
|
| self.waterfall_url = waterfall_url
|
| self.build_url = build_url
|
| self.project_name = project_name
|
| @@ -46,13 +48,6 @@ class MailTemplate(object):
|
| builder_name = build_status['builderName']
|
| us_steps = ','.join(build_status['unsatisfied'])
|
| revisions_list = build_status['revisions']
|
| - status_text = self.status_header % {
|
| - 'builder': builder_name,
|
| - 'steps': us_steps,
|
| - }
|
| -
|
| - # Use the first line as a title.
|
| - status_title = status_text.split('\n', 1)[0]
|
| blame_list = ','.join(build_status['blamelist'])
|
| revisions_string = ''
|
| latest_revision = 0
|
| @@ -65,16 +60,23 @@ class MailTemplate(object):
|
| result = 'warning'
|
|
|
| context = {
|
| - 'status_title': status_title,
|
| - 'waterfall_url': self.waterfall_url,
|
| - 'status': status_text.replace('\n', "<br>\n"),
|
| - 'build_url': self.build_url,
|
| - 'revisions': revisions_string,
|
| 'blame_list': blame_list,
|
| 'build_status': build_status,
|
| + 'build_url': self.build_url,
|
| 'builder_name': builder_name,
|
| + 'revisions': revisions_string,
|
| + 'steps': us_steps,
|
| + 'waterfall_url': self.waterfall_url,
|
| }
|
|
|
| + status_text = self.status_header % context
|
| +
|
| + # Use the first line as a title.
|
| + status_title = status_text.split('\n', 1)[0]
|
| +
|
| + context['status'] = status_text.replace('\n', "<br>\n")
|
| + context['status_title'] = status_title
|
| +
|
| html_content = jinja_environment.get_template('waterfall_mail.html').render(
|
| context)
|
|
|
| @@ -83,8 +85,8 @@ class MailTemplate(object):
|
|
|
| subject = self.subject % {
|
| 'result': result,
|
| - 'projectName': self.project_name,
|
| - 'builder': builder_name,
|
| + 'project_name': self.project_name,
|
| + 'builder_name': builder_name,
|
| 'reason': build_status['reason'],
|
| 'revision': str(latest_revision),
|
| 'buildnumber': str(build_status['number']),
|
|
|