~ursinha/+junk/putting-stuff-together

« back to all changes in this revision

Viewing changes to server-bug-triage/reporting.py

  • Committer: Ursula Junque
  • Date: 2011-08-13 20:29:46 UTC
  • Revision ID: ursula@cranberry-20110813202946-5sg0f29s8udklu0r
add wiki output to release-bugs report

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
def write_wiki_output(data_dict, output_filename):
72
72
    reportfile = open(output_filename, 'w')
73
73
    reportfile.write("<<TableOfContents>>\n")
 
74
 
74
75
    for title, bugtasks in data_dict.iteritems():
 
76
 
75
77
        reportfile.write("= %s =\n" % title)
 
78
 
 
79
        reportfile.write("|| Bug # || Title || Package || Status || "
 
80
            "Importance || Assignee || Milestone || Bug Last Touched ||\n")
76
81
        for bugtask in bugtasks:
77
 
            reportfile.write(' * Bug #Bug:%s in %s: "%s"\n' % (
78
 
                bugtask.bug_id, bugtask.target, bugtask.bug.title))
79
 
            reportfile.write('  * Status: %s / Importance: %s\n' % (
80
 
                bugtask.status, bugtask.importance))
 
82
            assignee = "-"
 
83
            milestone = "-"
 
84
 
81
85
            if bugtask.assignee:
82
 
                reportfile.write('  * Assigned to: %s (~%s)\n' %
83
 
                        (bugtask.assignee.name,
84
 
                        bugtask.assignee.display_name))
 
86
                assignee = "[[https://launchpad.net/~%s | %s]]" % (
 
87
                    bugtask.assignee.name, bugtask.assignee.display_name)
85
88
            if bugtask.milestone:
86
 
                reportfile.write('  * Milestone: %s\n' %
87
 
                    bugtask.milestone.name)
88
 
            reportfile.write('  * Bug Last Touched: %s\n' %
89
 
                    bugtask.bug.last_changed.strftime("%Y-%m-%d %H:%M"))
 
89
                milestone = ("[[https://launchpad.net/ubuntu/+milestone/%s | %s]]"
 
90
                    % (bugtask.milestone.name, bugtask.milestone.name))
 
91
 
 
92
            line = "|| #Bug:%s || %s || %s || %s || %s || %s || %s|| %s ||\n" % (
 
93
                bugtask.bug_id, bugtask.bug.title, bugtask.target,
 
94
                bugtask.status, bugtask.importance, assignee, milestone,
 
95
                bugtask.bug.last_changed.strftime("%Y-%m-%d %H:%M"))
 
96
            reportfile.write(line)
90
97
    reportfile.flush()
91
98
    reportfile.close()
92
99