}
"""
- self.index_first = """
+ self.index_file = """
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<table>
<tr>
- <td class="%%s"><a href="index.html">Active Bugs</a></td>
- <td class="%%s"><a href="index_inactive.html">Inactive Bugs</a></td>
+ <td class="%s"><a href="index.html">Active Bugs</a></td>
+ <td class="%s"><a href="index_inactive.html">Inactive Bugs</a></td>
</tr>
</table>
<table class="table_bug">
<tbody>
- """ % self.bd.encoding
+
+ %s
+
+ </tbody>
+ </table>
+
+ </div>
+
+ <div class="footer">Generated by <a href="http://www.bugseverywhere.org/">BugsEverywhere</a> on %s</div>
+
+ </body>
+ </html>
+ """
self.bug_line ="""
<tr class="%s-row">
</tr>
"""
- self.detail_first = """
+ self.detail_file = """
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<div class="main">
<h1>BugsEverywhere Bug List</h1>
- <h5><a href="%%s">Back to Index</a></h5>
+ <h5><a href="%s">Back to Index</a></h5>
<h2>Bug: _bug_id_</h2>
<table >
<tbody>
- """ % self.bd.encoding
- self.detail_line ="""
- <tr>
- <td align="right">%s</td><td>%s</td>
- </tr>
- """
+ %s
+
- self.index_last = """
</tbody>
</table>
-
</div>
-
- <div class="footer">Generated by <a href="http://www.bugseverywhere.org/">BugsEverywhere</a> on %s</div>
-
+ <h5><a href="%s">Back to Index</a></h5>
+ <div class="footer">Generated by <a href="http://www.bugseverywhere.org/">BugsEverywhere</a>.</div>
</body>
</html>
+
"""
+ self.detail_line ="""
+ <tr>
+ <td align="right">%s</td><td>%s</td>
+ </tr>
+ """
+
+
+
self.comment_section = """
"""
</td>
</tr>
"""
-
- self.detail_last = """
- </tbody>
- </table>
- </div>
- <h5><a href="%s">Back to Index</a></h5>
- <div class="footer">Generated by <a href="http://www.bugseverywhere.org/">BugsEverywhere</a>.</div>
- </body>
- </html>
- """
-
+
if template != None:
try:
FI = open("%s/style.css"%self.template)
except:
pass
try:
- FI = open("%s/index_first.tpl"%self.template)
+ FI = open("%s/index_file.tpl"%self.template)
self.index_first = FI.read()
FI.close()
except:
pass
+
try:
- FI.open("%s/bug_line.tpl"%self.template)
- self.bug_line = FI.read()
- FI.close()
- except:
- pass
- try:
- FI.open("%s/detail_first.tpl"%self.template)
+ FI.open("%s/detail_file.tpl"%self.template)
self.detail_first = FI.read()
FI.close()
except:
pass
- try:
- FI = open("%s/index_last.tpl"%self.template)
- self.index_last = FI.read()
- FI.close()
- except:
- pass
- try:
- FI = open("%s/detail_last.tpl"%self.template)
- self.d_last = FI.read()
- FI.close()
- except:
- pass
-
-
+
def create_index_file(self, out_dir_path, summary, bugs, ordered_bug, fileid, encoding):
+
try:
os.stat(out_dir_path)
except:
if self.verbose:
print "Creating active bug index..."
FO = codecs.open(out_dir_path+"/index.html", "w", encoding)
- FO.write(self.index_first%('td_sel','td_nsel'))
if fileid == "inactive":
if self.verbose:
print "Creating inactive bug index..."
FO = codecs.open(out_dir_path+"/index_inactive.html", "w", encoding)
- FO.write(self.index_first%('td_nsel','td_sel'))
except:
raise cmdutil.UsageError, "Cannot create the index.html file."
c = 0
t = len(bugs) - 1
+ line = ""
for l in range(t, -1, -1):
if self.verbose:
print "Creating bug entry: %s"%escape(bugs[l].uuid[0:3])
- line = self.bug_line%(escape(bugs[l].severity),
+ line += self.bug_line%(escape(bugs[l].severity),
escape(bugs[l].uuid), escape(bugs[l].uuid[0:3]),
escape(bugs[l].uuid), escape(bugs[l].status),
escape(bugs[l].uuid), escape(bugs[l].severity),
escape(bugs[l].uuid), escape(bugs[l].summary),
escape(bugs[l].uuid), escape(bugs[l].time_string)
)
- FO.write(line)
c += 1
if self.verbose:
print "\tCreating detail entry for bug: %s"%escape(bugs[l].uuid[0:3])
self.create_detail_file(bugs[l], out_dir_path, fileid, encoding)
when = time.ctime()
- FO.write(self.index_last%when)
+
+ try:
+ if fileid == "active":
+ if self.verbose:
+ print "Writing active bug index..."
+ FO.write(self.index_file%(encoding, 'td_sel','td_nsel', line, when))
+ if fileid == "inactive":
+ if self.verbose:
+ print "Writing inactive bug index..."
+ FO.write(self.index_file%(encoding,'td_nsel','td_sel', line, when))
+ except:
+ raise cmdutil.UsageError, "Cannot create the index.html file."
def create_detail_file(self, bug, out_dir_path, fileid, encoding):
except:
raise cmdutil.UsageError, "Cannot create the detail html file."
- detail_first_ = re.sub('_bug_id_', bug.uuid[0:3], self.detail_first)
- if fileid == "active":
- FD.write(detail_first_%"../index.html")
- if fileid == "inactive":
- FD.write(detail_first_%"../index_inactive.html")
-
-
-
+ detail_file_ = re.sub('_bug_id_', bug.uuid[0:3], self.detail_file)
+
bug_ = self.bd.bug_from_shortname(bug.uuid)
bug_.load_comments(load_full=True)
+ det_line = ""
+ det_line += self.detail_line%("ID : ", bug.uuid)
+ det_line += self.detail_line%("Short name : ", escape(bug.uuid[0:3]))
+ det_line += self.detail_line%("Severity : ", escape(bug.severity))
+ det_line += self.detail_line%("Status : ", escape(bug.status))
+ det_line += self.detail_line%("Assigned : ", escape(bug.assigned))
+ det_line += self.detail_line%("Target : ", escape(bug.target))
+ det_line += self.detail_line%("Reporter : ", escape(bug.reporter))
+ det_line += self.detail_line%("Creator : ", escape(bug.creator))
+ det_line += self.detail_line%("Created : ", escape(bug.time_string))
+ det_line += self.detail_line%("Summary : ", escape(bug.summary))
+ det_line += """<tr><td colspan="2"><hr /></td></tr>"""
- FD.write(self.detail_line%("ID : ", bug.uuid))
- FD.write(self.detail_line%("Short name : ", escape(bug.uuid[0:3])))
- FD.write(self.detail_line%("Severity : ", escape(bug.severity)))
- FD.write(self.detail_line%("Status : ", escape(bug.status)))
- FD.write(self.detail_line%("Assigned : ", escape(bug.assigned)))
- FD.write(self.detail_line%("Target : ", escape(bug.target)))
- FD.write(self.detail_line%("Reporter : ", escape(bug.reporter)))
- FD.write(self.detail_line%("Creator : ", escape(bug.creator)))
- FD.write(self.detail_line%("Created : ", escape(bug.time_string)))
- FD.write(self.detail_line%("Summary : ", escape(bug.summary)))
- FD.write("<tr><td colspan=\"2\"><hr /></td></tr>")
+ if fileid == "active":
+ FD.write(detail_file_%(encoding, "../index.html", det_line, "../index.html"))
+ if fileid == "inactive":
+ FD.write(detail_file_%(encoding, "../index_inactive.html", det_line, "../index_inactive.html"))
+
FD.write(self.begin_comment_section)
tr = []
b = ''
stack.pop(-1)
FD.write("</div>\n") # close every remaining <div class="comment...
FD.write(self.end_comment_section)
- if fileid == "active":
- FD.write(self.detail_last%"../index.html")
- if fileid == "inactive":
- FD.write(self.detail_last%"../index_inactive.html")
FD.close()