Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2577)

Unified Diff: gatekeeper_mailer.py

Issue 143263025: Add support to change the status header for gatekeeper-ng. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/chromium-build
Patch Set: Rename to use status_header instead of status. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app_test.py ('k') | mailer.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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']),
« no previous file with comments | « app_test.py ('k') | mailer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698