class BugListingBatchNavigator(TableBatchNavigator):
"""A specialised batch navigator to load smartly extra bug information."""
@@ -1956,6 +1965,7 @@
# to a mixin so that MilestoneView and others can use it.
-def print_bugtasks(text):
+def print_bugtasks(text, show_heat=None):
"""Print all the bugtasks in the text."""
- print '\n'.join(extract_bugtasks(text))
-
-
-def extract_bugtasks(text):
+ print '\n'.join(extract_bugtasks(text, show_heat=show_heat))
+
+
+def extract_bugtasks(text, show_heat=None):
"""Extracts a list of strings for all the bugtasks in the text."""
main_content = find_main_content(text)
table = main_content.find('table', {'id': 'buglisting'})
if table is None:
return []
- return [extract_text(tr) for tr in table('tr') if tr.td is not None]
+ rows = []
+ for tr in table('tr'):
+ if tr.td is not None:
+ row_text = extract_text(tr)
+ if show_heat:
+ heat_text = ''
+ for img in tr.findAll('img'):
+ if img['src'] == '/@@/flame-icon':
+ heat_text += '*'
+ elif img['src'] == '/@@/flame-bw-icon':
+ heat_text += '-'
+ else:
+ pass
+ row_text += '\n' + heat_text
+ rows.append(row_text)
+ return rows
This branch depends on a previous branch which still hasn't landed. The diff for this work is:
=== modified file 'lib/canonical/ launchpad/ templates/ bugs-listing- table-without- navlinks. pt' launchpad/ templates/ bugs-listing- table-without- navlinks. pt 2009-07-17 17:59:07 +0000 launchpad/ templates/ bugs-listing- table-without- navlinks. pt 2010-01-19 20:12:24 +0000
Importance< /th> "context/ show_column/ status| nothing" >Status< /th> "context/ show_column/ date_last_ updated| nothing" > "context/ show_column/ heat|nothing" > "bugtask/ bug/date_ last_updated/ fmt:date"
tal: condition= "context/ show_column/ date_last_ updated| nothing" >
2007- 11-25</ td> "context/ show_column/ heat|nothing" "structure bugtask/ bug_heat_ html"
--- lib/canonical/
+++ lib/canonical/
@@ -22,7 +22,11 @@
<th tal:condition=
<th tal:condition=
- Date last updated</th>
+ Date last updated
+ </th>
+ <th tal:condition=
+ Heat
+ </th>
</tr>
</thead>
<tbody>
@@ -64,6 +68,10 @@
<td tal:content=
+ <td tal:condition=
+ tal:content=
+ style="text-align: center">
+ HEAT</td>
</tr>
</tbody>
</table>
=== modified file 'lib/lp/ bugs/browser/ bugtask. py' bugs/browser/ bugtask. py 2010-01-19 16:43:20 +0000 bugs/browser/ bugtask. py 2010-01-19 20:11:00 +0000 IBugTask, 'bugtask')
--- lib/lp/
+++ lib/lp/
@@ -1935,12 +1935,13 @@
delegates(
def __init__(self, bugtask, has_mentoring_ offer, has_bug_branch,
self. bugtask = bugtask
self. review_ action_ widget = None
self. has_mentoring_ offer = has_mentoring_offer
self. has_bug_ branch = has_bug_branch
self. has_specificati on = has_specification
- has_specification):
+ has_specification, request=None):
+ self.request = request
@property t_change_ date(self) :
self. bugtask. date_inprogress or self.bugtask. date_left_ new or
self. bugtask. datecreated)
def last_significan
@@ -1949,6 +1950,14 @@
+ @property html(self) :
+ def bug_heat_
+ """Returns the bug heat flames HTML."""
+ view = getMultiAdapter(
+ (self.bugtask.bug, self.request),
+ name='+bug-heat')
+ return view()
+
class BugListingBatch Navigator( TableBatchNavig ator):
"""A specialised batch navigator to load smartly extra bug information."""
@@ -1956,6 +1965,7 @@
# to a mixin so that MilestoneView and others can use it.
def __init__(self, tasks, request, columns_to_show, size):
TableBatchNav igator. __init_ _( to_show= columns_ to_show, size=size)
+ self.request = request
self, tasks, request, columns_
@@ -1971,7 +1981,8 @@
bugtask,
badge_ property[ 'has_mentoring_ offer'] ,
badge_ property[ 'has_branch' ], 'has_specificat ion']) 'has_specificat ion'], self.request)
- badge_property[
+ badge_property[
+ request=
def getBugListingIt ems(self) :
"""Return a decorated list of visible bug tasks."""
@@ -2191,11 +2202,11 @@
if (upstream_context or productseries_ context or
distrosou rcepackage_ context or sourcepackage_ context) : context or distroseries_ context:
"Unrecognize d context; don't know which report "
- return ["id", "summary", "importance", "status"]
+ return ["id", "summary", "importance", "status", "heat"]
elif distribution_
- return ["id", "summary", "packagename", "importance", "status"]
+ return ["id", "summary", "packagename", "importance", "status", "heat"]
elif project_context:
- return ["id", "summary", "productname", "importance", "status"]
+ return ["id", "summary", "productname", "importance", "status", "heat"]
else:
raise AssertionError(
@@ -3370,7 +3381,7 @@
"""Search all bug reports."""
columns_ to_show = ["id", "summary", "bugtargetdispl ayname" , skSearch widget( 'scope' , ProjectScopeWidget) providedBy( self.context) providedBy( self.context) ): updated' ] updated' , 'heat'] updated' ] updated' , 'heat']
- "importance", "status"]
+ "importance", "status", "heat"]
schema = IFrontPageBugTa
custom_
page_title = 'Search'
@@ -3579,9 +3590,9 @@
"""Show the columns that summarise expirable bugs."""
if (IDistribution.
or IDistroSeries.
- return ['id', 'summary', 'packagename', 'date_last_
+ return ['id', 'summary', 'packagename', 'date_last_
else:
- return ['id', 'summary', 'date_last_
+ return ['id', 'summary', 'date_last_
@property
def search(self):
=== modified file 'lib/lp/ bugs/stories/ bugtask- searches/ xx-listing- basics. txt' bugs/stories/ bugtask- searches/ xx-listing- basics. txt 2009-11-27 14:39:43 +0000 bugs/stories/ bugtask- searches/ xx-listing- basics. txt 2010-01-19 20:44:51 +0000 launchpad. dev/debian/ +milestone/ 3.1" alt="milestone 3.1"
--- lib/lp/
+++ lib/lp/
@@ -223,3 +223,14 @@
<a href="http://
title="Linked to milestone 3.1" class="sprite milestone"></a>
+ launchpad. dev/firefox/ +bugs?field. searchtext= install& search= Search& advanced= &milestone= 1&status= 10&status= 20&assignee= all") user_browser. contents, show_heat=True)
+== Bug heat in listings ==
+
+Bug listings display the bug heat in the last column. Heat is displayed as four flame
+images, marked here as '-'.
+
+ >>> user_browser.open("http://
+ >>> print_bugtasks(
+ 5 Firefox install instructions should be complete Critical New ----
+ 1 Firefox does not support SVG Low New ----
+
=== modified file 'lib/lp/ bugs/tests/ bug.py' bugs/tests/ bug.py 2009-11-06 20:28:16 +0000 bugs/tests/ bug.py 2010-01-19 20:40:37 +0000
--- lib/lp/
+++ lib/lp/
@@ -108,18 +108,33 @@
print extract_text(node)
-def print_bugtasks( text): text, show_heat=None): extract_ bugtasks( text)) bugtasks( text): extract_ bugtasks( text, show_heat= show_heat) ) bugtasks( text, show_heat=None): content( text) find('table' , {'id': 'buglisting'}) bw-icon' : row_text)
+def print_bugtasks(
"""Print all the bugtasks in the text."""
- print '\n'.join(
-
-
-def extract_
+ print '\n'.join(
+
+
+def extract_
"""Extracts a list of strings for all the bugtasks in the text."""
main_content = find_main_
table = main_content.
if table is None:
return []
- return [extract_text(tr) for tr in table('tr') if tr.td is not None]
+ rows = []
+ for tr in table('tr'):
+ if tr.td is not None:
+ row_text = extract_text(tr)
+ if show_heat:
+ heat_text = ''
+ for img in tr.findAll('img'):
+ if img['src'] == '/@@/flame-icon':
+ heat_text += '*'
+ elif img['src'] == '/@@/flame-
+ heat_text += '-'
+ else:
+ pass
+ row_text += '\n' + heat_text
+ rows.append(
+ return rows
def create_ task_from_ strings( bug, owner, product, watchurl=None):