-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsummarypage.py
executable file
·56 lines (43 loc) · 1.98 KB
/
summarypage.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
from mako.template import Template
import cgi
import cgitb
import os
import sqlite3
from lib.tabledescription import TableDescription
from lib import resultsquery
def create_detail_link_function(headers, category):
def create_detail_link(row, col_index):
return "detailpage.py?uplid={}&ufid={}&category={}&uor={}".format(
row[0], row[1], category, headers[col_index])
return create_detail_link
def create_summary_link_function(headers):
def create_detail_link(row, col_index):
return "detailpage.py?uplid={}&ufid={}&category={}".format(
row[0], row[1], headers[col_index])
return create_detail_link
def main():
conn = sqlite3.connect('example_results.db')
result = resultsquery.create_summary_table(conn)
results = [TableDescription("Build Summary", "Build Summary", result[0][0], result[1], create_summary_link_function(result[0][0]))]
DETAILS = ['BUILD_ERROR', 'TEST_RUN_FAILURE', 'BUILD_WARNING']
for type in DETAILS:
result = resultsquery.create_package_group_detail_table(conn, type)
results.append(TableDescription(resultsquery.category_transform(type),
resultsquery.category_transform(type),
result[0][0],
result[1],
create_detail_link_function(result[0][0], type)))
commit_info = resultsquery.create_commit_information_table(conn)
attribute_info = resultsquery.create_build_attributes_information_table(conn)
results.append(commit_info)
results.append(attribute_info)
print(Template(filename="./summarypage.mako").render(tables = results,
commit_info = commit_info))
conn.close()
if __name__ == "__main__":
if 'GATEWAY_INTERFACE' in os.environ:
cgitb.enable()
print("Content-type: text/html")
print()
main()