aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGianluca Montecchi <gian@grys.it>2009-07-19 00:58:14 +0200
committerGianluca Montecchi <gian@grys.it>2009-07-19 00:58:14 +0200
commit80d4ea738b62f0a958bb3924b9f4c46d810bcd14 (patch)
treea80d7a00b98373e998f2a447e96d35899551f7b4
parentf33d0625cdd8caad858e6ab8b0df3cede051733e (diff)
downloadbugseverywhere-80d4ea738b62f0a958bb3924b9f4c46d810bcd14.tar.gz
Created the index
-rw-r--r--becommands/html.py78
-rw-r--r--becommands/html_data.py69
2 files changed, 72 insertions, 75 deletions
diff --git a/becommands/html.py b/becommands/html.py
index df7a99f..224c876 100644
--- a/becommands/html.py
+++ b/becommands/html.py
@@ -55,19 +55,19 @@ def execute(args, test=False):
st = {}
se = {}
stime = {}
+ bugs = []
for s in status_list:
st[s] = 0
- for s in severity_list:
- se[s] = 0
-
for b in bd:
stime[b.uuid] = b.time
+ if b.status == "open":
+ bugs.append(b)
st[b.status] += 1
- se[b.severity] += 1
- stime_sorted = sorted([(value,key) for (key,value) in stime.items()])
-
+ ordered_bug_list = sorted([(value,key) for (key,value) in stime.items()])
+ #open_bug_list = sorted([(value,key) for (key,value) in bugs.items()])
+
html_gen = BEHTMLGen()
- html_gen.create_index_file(out_dir, st, se, stime_sorted)
+ html_gen.create_index_file(out_dir, st, bugs, ordered_bug_list)
def get_parser():
parser = cmdutil.CmdOptionParser("be open OUTPUT_DIR")
@@ -85,7 +85,7 @@ class BEHTMLGen():
def __init__(self):
self.index_value = ""
- def create_index_file(self, out_dir_path, summary, severity, last_bug):
+ def create_index_file(self, out_dir_path, summary, bugs, ordered_bug):
try:
os.stat(out_dir_path)
except:
@@ -99,38 +99,52 @@ class BEHTMLGen():
FO.close()
except:
raise cmdutil.UsageError, "Cannot create the style.css file."
- value = html_index
- for stat in summary:
- rep = "_"+stat+"_"
- val = str(summary[stat])
- value = re.sub(rep, val, value)
- for sev in severity:
- rep = "_"+sev+"_"
- val = str(severity[sev])
- value = re.sub(rep, val, value)
+ try:
+ os.mkdir(out_dir_path+"/bugs")
+ except:
+ pass
+
+ try:
+ FO = open(out_dir_path+"/index.html", "w")
+ except:
+ raise cmdutil.UsageError, "Cannot create the index.html file."
+
+ FO.write(index_first)
c = 0
- t = len(last_bug)-1
+ t = len(bugs) - 1
for l in range(t, 0, -1):
- line = ""
- line = re.sub('_BUG_ID_', last_bug[l][1], last_activity)
- line1 = re.sub('_BUG_', last_bug[l][1][0:3], line)
- line2 = re.sub('_DATE_', time.ctime(last_bug[l][0]), line1)
+ line = bug_line
+ line1 = re.sub('_bug_id_link_', bugs[l].uuid, line)
+ line = line1
+ line1 = re.sub('_bug_id_', bugs[l].uuid[0:3], line)
+ line = line1
+ line1 = re.sub('_status_', bugs[l].status, line)
+ line = line1
+ line1 = re.sub('_sev_', bugs[l].severity, line)
+ line = line1
+ line1 = re.sub('_descr_', bugs[l].summary, line)
+ line = line1
+ line2 = re.sub('_time_', time.ctime(bugs[l].time), line1)
if c%2 == 0:
linef = re.sub('_ROW_', "even-row", line2)
else:
linef = re.sub('_ROW_', "odd-row", line2)
- self.index_value += linef
+ FO.write(linef)
c += 1
- if c == 10:
- break
-
- value = re.sub("_LAST_ACTVITY_", self.index_value, value)
+ self.CreateDetailFile(bugs[l], out_dir_path)
+ FO.write(index_last)
+
+ def CreateDetailFile(self, bug, out_dir_path):
+ f = "%s.html"%bug.uuid
+ p = out_dir_path+"/bugs/"+f
try:
- FO = open(out_dir_path+"/index.html", "w")
- FO.write(value)
- FO.close()
+ FD = open(p, "w")
except:
- raise cmdutil.UsageError, "Cannot create the index.html file."
-
+ raise cmdutil.UsageError, "Cannot create the detail html file."
+
+ FD.write(index_first)
+
+ FD.write(index_last)
+ FD.close() \ No newline at end of file
diff --git a/becommands/html_data.py b/becommands/html_data.py
index 460daa8..f9c966a 100644
--- a/becommands/html_data.py
+++ b/becommands/html_data.py
@@ -18,6 +18,16 @@ margin-top: 1em;
background-color: #fcfcfc;
}
+.even-row {
+background-color: #e9e9e2;
+width: 5%;
+}
+
+.odd-row {
+
+background-color: #f9f9f9;
+width: 5%;
+}
.person {
font-family: courier;
@@ -207,7 +217,7 @@ background-color: #ddd;
}
"""
-html_index = """
+index_first = """
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>BugsEverywhere Issue Tracker</title>
@@ -219,59 +229,32 @@ html_index = """
<div class="main">
<h1>BugsEverywhere Bug List</h1>
-<table>
+<h2>Open Bugs</h2>
+<table width=100%>
<tbody>
-<tr>
-<td>
- <h2>Bugs summary divided by status</h2>
- <table width=100%>
- <tbody>
- <tr>
- <td class="plain-cell">
- <a href="unconfirmed.html">_unconfirmed_ unconfirmed</a>
- </td>
- <td class="plain-cell">
- <a href="open.html">_open_ open</a>
- </td>
- <td class="plain-cell">
- <a href="assigned.html">_assigned_ assigned</a>
- </td>
- <td class="plain-cell">
- <a href="test.html">_test_ test</a>
- </td>
- <td class="plain-cell">
- <a href="closed.html">_closed_ closed</a>
- </td>
- <td class="plain-cell">
- <a href="fixed.html">_fixed_ fixed</a>
- </td>
- <td class="plain-cell">
- <a href="wontfix.html">_wontfix_ wontfix</a>
- </td>
- <td class="plain-cell">
- <a href="disabled.html">_disabled_ disabled</a>
- </td>
- </tr>
- </tbody>
- </table>
-</td>
+"""
+
+bug_line ="""
+<tr class=_ROW_>
+ <td><a href="bugs/_bug_id_link_.html">_bug_id_</a></td>
+ <td><a href="bugs/_bug_id_link_.html">_status_</a></td>
+ <td><a href="bugs/_bug_id_link_.html">_sev_</a></td>
+ <td><a href="bugs/_bug_id_link_.html">_descr_</a></td>
+ <td><a href="bugs/_bug_id_link_.html">_time_</a></td>
</tr>
+"""
+
+index_last = """
</tbody>
</table>
</div>
-<h2>Showing all bugs</h2>
+<h2>Show all bugs</h2>
<div class="footer">Generated by <a href="http://www.bugseverywhere.org/">BugsEverywhere</a>.</div>
-
</body>
</html>
"""
-last_activity = """
- <tr class="_ROW_">
- <td><a href="_BUG_ID_.html">_BUG_ on _DATE_</a></td>
- </tr>
-"""