def get_HTML_mail(self,name='',build=None, build_url=None, waterfall_url=None, failed_step='', failed_tests=None, status_text='', test_reasoning='', change=''): files_added = [] files_modified = [] files_renamed = [] files_removed = [] files_added_lbl = '' files_modified_lbl = '' files_renamed_lbl = '' files_removed_lbl = '' failed_tests_data = '' branch_link = '' rev_no = change.revision if change.hash: revision = "Revision: <b>%s</b><br />\n" % change.hash branch = "" try: if change.branch: i = change.branch.index('launchpad') branch_link = 'https://bazaar.' + change.branch[i:] + '/revision/' + str(rev_no) + '#' branch = change.branch except Exception: pass if failed_tests: failed_tests_data = "<ul>" for ftn, ft_url, ft_text in failed_tests: failed_tests_data += '<li><a href="%s">%s</a>: %s</li>\n' % \ (ft_url, ftn, ft_text) failed_tests_data += '</ul>\n' try: who_name = change.who[:change.who.index('<')] except: who_name = change.who kwargs = { 'who_name' : tools._to_unicode(who_name), 'project_name' : self.projectName, 'name' : name, 'waterfall_url' : urllib.quote(waterfall_url, '/:') , 'build_url' : build_url, 'name_quote' : urllib.quote(name), 'failed_step' : failed_step, 'status_text' : status_text, 'who' : tools._to_unicode(change.who), 'when' : formatdate(change.when,usegmt=True), 'branch' : branch, 'revision' : change.revision, 'rev_no': rev_no, 'files_added' : files_added_lbl + html.UL(files_added), 'files_modified' : files_modified_lbl + html.UL(files_modified), 'files_renamed' : files_renamed_lbl + html.UL(files_renamed), 'files_removed' : files_removed_lbl + html.UL(files_removed), 'failed_tests_data': failed_tests_data, 'comments': change.comments, 'reason':build.getReason()} kwargs['test_reasoning'] = test_reasoning % kwargs return tools._to_decode(html_mail % kwargs)
def get_TEXT_mail(self, name='', build=None, build_url=None, waterfall_url=None, failed_step='', failed_tests=None, status_text='', test_reasoning='', change=''): files_added = [] files_modified = [] files_renamed = [] files_removed = [] files_added_lbl = '' files_modified_lbl = '' files_renamed_lbl = '' files_removed_lbl = '' failed_tests_data = '' branch_link = '' rev_no = change.revision if change.hash: revision = change.hash branch = "" try: if change.branch: i = change.branch.index('launchpad') branch_link = 'https://bazaar.' + change.branch[ i:] + '/revision/' + str(rev_no) + '#' branch = change.branch except Exception: pass if failed_tests: failed_tests_data = "\nTest results:\n--------------\n" for ftn, ft_url, ft_text in failed_tests: failed_tests_data += '%s: %s\n%s\n\n' % \ (ftn, ft_url, ft_text) try: who_name = change.who[:change.who.index('<')] except: who_name = change.who kwargs = { 'who_name': tools._to_unicode(who_name), 'project_name': self.projectName, 'name': name, 'waterfall_url': urllib.quote(waterfall_url, '/:'), 'build_url': build_url, 'name_quote': urllib.quote(name), 'failed_step': failed_step, 'status_text': status_text, 'who': tools._to_unicode(change.who), 'when': formatdate(change.when, usegmt=True), 'branch': branch, 'revision': revision, 'rev_no': rev_no, 'files_added': files_added_lbl + '\n'.join(files_added), 'files_modified': files_modified_lbl + '\n'.join(files_modified), 'files_renamed': files_renamed_lbl + '\n'.join(files_renamed), 'files_removed': files_removed_lbl + '\n'.join(files_removed), 'failed_tests_data': failed_tests_data, 'comments': change.comments, 'reason': build.getReason() } kwargs['test_reasoning'] = test_reasoning % kwargs return tools._to_decode(text_mail % kwargs)
def get_TEXT_mail(self,name='',build = None,build_url=None,waterfall_url=None,failed_step='',status_text='',change=''): files_added = [] files_modified = [] files_renamed = [] files_removed = [] files_added_lbl = '' files_modified_lbl = '' files_renamed_lbl = '' files_removed_lbl = '' branch_link = '' rev_no = change.revision if change.revision_id: revision = change.revision_id branch = "" if change.branch: i = change.branch.index('launchpad') branch_link = 'https://bazaar.' + change.branch[i:] + '/revision/' + str(rev_no) + '#' branch = change.branch if change.files_added: files_added_lbl = "\n\nAdded files: \n" + "---------------\n" for file in change.files_added: file_link = branch_link + file files_added.append(" * %s \n ( %s )" % (file, file_link)) if change.files_modified: files_modified_lbl = "\n\nModified files: \n" + "---------------\n" for file in change.files_modified: file_link = branch_link + file files_modified.append(" * %s \n ( %s )" % (file, file_link)) if change.files_renamed: files_renamed_lbl = "\n\nRenamed files: \n" + "---------------\n" for file in change.files_renamed: file_link = branch_link + file[1] files_renamed.append(" * %s ==> %s \n ( %s )" % (file[0], file[1], file_link)) if change.files_removed: files_removed_lbl = "\n\nRemoved files: \n" + "---------------\n" for file in change.files_removed: file_link = branch_link + file files_removed.append(" * %s \n ( %s )" % (file, file_link)) try: who_name = change.who[:change.who.index('<')] except: who_name = change.who kwargs = { 'who_name' : tools._to_unicode(who_name), 'project_name' : self.projectName, 'name' : name, 'waterfall_url' : urllib.quote(waterfall_url, '/:'), 'build_url' : build_url, 'name_quote' : urllib.quote(name), 'failed_step' : failed_step, 'status_text' : status_text, 'who' : tools._to_unicode(change.who), 'when' : formatdate(change.when,usegmt=True), 'branch' : branch, 'revision' : revision, 'rev_no': rev_no, 'files_added' : files_added_lbl + '\n'.join(files_added), 'files_modified' : files_modified_lbl + '\n'.join(files_modified), 'files_renamed' : files_renamed_lbl + '\n'.join(files_renamed), 'files_removed' : files_removed_lbl + '\n'.join(files_removed), 'comments': change.comments, 'reason':build.getReason()} return tools._to_decode(text_mail % kwargs)