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' --- lib/canonical/launchpad/templates/bugs-listing-table-without-navlinks.pt 2009-07-17 17:59:07 +0000 +++ lib/canonical/launchpad/templates/bugs-listing-table-without-navlinks.pt 2010-01-19 20:12:24 +0000 @@ -22,7 +22,11 @@ Importance Status - Date last updated + Date last updated + + + Heat + @@ -64,6 +68,10 @@ 2007-11-25 + + HEAT === modified file 'lib/lp/bugs/browser/bugtask.py' --- lib/lp/bugs/browser/bugtask.py 2010-01-19 16:43:20 +0000 +++ lib/lp/bugs/browser/bugtask.py 2010-01-19 20:11:00 +0000 @@ -1935,12 +1935,13 @@ delegates(IBugTask, 'bugtask') def __init__(self, bugtask, has_mentoring_offer, has_bug_branch, - has_specification): + has_specification, request=None): self.bugtask = bugtask self.review_action_widget = None self.has_mentoring_offer = has_mentoring_offer self.has_bug_branch = has_bug_branch self.has_specification = has_specification + self.request = request @property def last_significant_change_date(self): @@ -1949,6 +1950,14 @@ self.bugtask.date_inprogress or self.bugtask.date_left_new or self.bugtask.datecreated) + @property + def bug_heat_html(self): + """Returns the bug heat flames HTML.""" + view = getMultiAdapter( + (self.bugtask.bug, self.request), + name='+bug-heat') + return view() + 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 __init__(self, tasks, request, columns_to_show, size): + self.request = request TableBatchNavigator.__init__( self, tasks, request, columns_to_show=columns_to_show, size=size) @@ -1971,7 +1981,8 @@ bugtask, badge_property['has_mentoring_offer'], badge_property['has_branch'], - badge_property['has_specification']) + badge_property['has_specification'], + request=self.request) def getBugListingItems(self): """Return a decorated list of visible bug tasks.""" @@ -2191,11 +2202,11 @@ if (upstream_context or productseries_context or distrosourcepackage_context or sourcepackage_context): - return ["id", "summary", "importance", "status"] + return ["id", "summary", "importance", "status", "heat"] elif distribution_context or distroseries_context: - 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( "Unrecognized context; don't know which report " @@ -3370,7 +3381,7 @@ """Search all bug reports.""" columns_to_show = ["id", "summary", "bugtargetdisplayname", - "importance", "status"] + "importance", "status", "heat"] schema = IFrontPageBugTaskSearch custom_widget('scope', ProjectScopeWidget) page_title = 'Search' @@ -3579,9 +3590,9 @@ """Show the columns that summarise expirable bugs.""" if (IDistribution.providedBy(self.context) or IDistroSeries.providedBy(self.context)): - return ['id', 'summary', 'packagename', 'date_last_updated'] + return ['id', 'summary', 'packagename', 'date_last_updated', 'heat'] else: - return ['id', 'summary', 'date_last_updated'] + return ['id', 'summary', 'date_last_updated', 'heat'] @property def search(self): === modified file 'lib/lp/bugs/stories/bugtask-searches/xx-listing-basics.txt' --- lib/lp/bugs/stories/bugtask-searches/xx-listing-basics.txt 2009-11-27 14:39:43 +0000 +++ lib/lp/bugs/stories/bugtask-searches/xx-listing-basics.txt 2010-01-19 20:44:51 +0000 @@ -223,3 +223,14 @@ + +== 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://launchpad.dev/firefox/+bugs?field.searchtext=install&search=Search&advanced=&milestone=1&status=10&status=20&assignee=all") + >>> print_bugtasks(user_browser.contents, show_heat=True) + 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' --- lib/lp/bugs/tests/bug.py 2009-11-06 20:28:16 +0000 +++ lib/lp/bugs/tests/bug.py 2010-01-19 20:40:37 +0000 @@ -108,18 +108,33 @@ print extract_text(node) -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 def create_task_from_strings(bug, owner, product, watchurl=None):