OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Provides mailer templates for gatekeeper_ng. | 6 """Provides mailer templates for gatekeeper_ng. |
7 | 7 |
8 This module populates jinja mail templates to notify tree watchers when the | 8 This module populates jinja mail templates to notify tree watchers when the |
9 tree is closed. | 9 tree is closed. |
10 """ | 10 """ |
(...skipping 20 matching lines...) Expand all Loading... |
31 default_subject = ('buildbot %(result)s in %(projectName)s on %(builder)s, ' | 31 default_subject = ('buildbot %(result)s in %(projectName)s on %(builder)s, ' |
32 'revision %(revision)s') | 32 'revision %(revision)s') |
33 | 33 |
34 def __init__(self, waterfall_url, build_url, project_name, fromaddr, | 34 def __init__(self, waterfall_url, build_url, project_name, fromaddr, |
35 reply_to=None, subject=None): | 35 reply_to=None, subject=None): |
36 | 36 |
37 | 37 |
38 self.reply_to = reply_to | 38 self.reply_to = reply_to |
39 self.fromaddr = fromaddr | 39 self.fromaddr = fromaddr |
40 self.subject = subject or self.default_subject | 40 self.subject = subject or self.default_subject |
41 self.waterfall_url = waterfall_url.rstrip('/') + '/' | 41 self.waterfall_url = waterfall_url |
42 self.build_url = build_url | 42 self.build_url = build_url |
43 self.project_name = project_name | 43 self.project_name = project_name |
44 | 44 |
45 def genMessageContent(self, build_status): | 45 def genMessageContent(self, build_status): |
46 builder_name = build_status['builderName'] | 46 builder_name = build_status['builderName'] |
47 us_steps = ','.join(build_status['unsatisfied']) | 47 us_steps = ','.join(build_status['unsatisfied']) |
48 revisions_list = build_status['revisions'] | 48 revisions_list = build_status['revisions'] |
49 status_text = self.status_header % { | 49 status_text = self.status_header % { |
50 'builder': builder_name, | 50 'builder': builder_name, |
51 'steps': us_steps, | 51 'steps': us_steps, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 subject = self.subject % { | 84 subject = self.subject % { |
85 'result': result, | 85 'result': result, |
86 'projectName': self.project_name, | 86 'projectName': self.project_name, |
87 'builder': builder_name, | 87 'builder': builder_name, |
88 'reason': build_status['reason'], | 88 'reason': build_status['reason'], |
89 'revision': str(latest_revision), | 89 'revision': str(latest_revision), |
90 'buildnumber': str(build_status['number']), | 90 'buildnumber': str(build_status['number']), |
91 } | 91 } |
92 | 92 |
93 return text_content, html_content, subject | 93 return text_content, html_content, subject |
OLD | NEW |