Merge lp:~deryck/launchpad/series-targeted-with-zero-bugs-364712 into lp:launchpad

Proposed by Deryck Hodge
Status: Merged
Merged at revision: not available
Proposed branch: lp:~deryck/launchpad/series-targeted-with-zero-bugs-364712
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~deryck/launchpad/series-targeted-with-zero-bugs-364712
Reviewer Review Type Date Requested Status
Eleanor Berger (community) Approve
Review via email: mp+10262@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

= Summary =

Bug 364712 notes that the list of links in the "Series-targeted bugs" on
a project's bugs home page lists obsolete series (or series with no bugs
listed).

== Proposed fix ==

A series should not be listed if it has no open bugs.

== Pre-implementation notes ==

None

== Implementation details ==

This branch fixes that by not adding the series to the list of
series_buglistings if the series.open_bugtasks.count() is 0.

Also, the template is modified to not included the portlet if the list
is empty using a tal:condition on series_buglistings.

There are some unused import clean ups here as well, which make lint
complained about.

== Tests ==

Run the now updated test:

./bin/test -vv -t xx-portlets-bug-series.txt

== Demo and Q/A ==

Demo:
    * Go to http://bugs.launchpad.dev/firefox
    * Verify that the 1.0 series is shown, with 1 bug
    * Go to https://bugs.launchpad.dev/jokosher
    * Verify that there is no "Series-targeted bugs" section

Q/A
    * Go to https://bugs.edge.launchpad.net/bzr
    * Verify that there is no "Series-targeted bugs" section
    * Go to https://bugs.edge.launchpad.net/malone
    * Verify that only the 1.2 series is listed, with 4 bugs

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/bugs/browser/bugtarget.py
  lib/lp/bugs/templates/bugtask-portlet-seriesbugs.pt
  lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqJlvUACgkQ4glRK0DaE8jjeQCg4/m+95yKNsNRDIhGU7fj9wS+
8J4An12G6d/WvHBApXmauazYyH8VFRRa
=vvUS
-----END PGP SIGNATURE-----

Revision history for this message
Eleanor Berger (intellectronica) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py 2009-07-27 14:14:53 +0000
+++ lib/lp/bugs/browser/bugtarget.py 2009-08-17 17:09:23 +0000
@@ -31,7 +31,6 @@
31from zope.app.form.browser import TextWidget31from zope.app.form.browser import TextWidget
32from zope.app.form.interfaces import InputErrors32from zope.app.form.interfaces import InputErrors
33from zope.component import getUtility33from zope.component import getUtility
34from zope.event import notify
35from zope import formlib34from zope import formlib
36from zope.interface import implements35from zope.interface import implements
37from zope.publisher.interfaces import NotFound36from zope.publisher.interfaces import NotFound
@@ -39,8 +38,6 @@
39from zope.schema import Choice38from zope.schema import Choice
40from zope.schema.vocabulary import SimpleVocabulary39from zope.schema.vocabulary import SimpleVocabulary
4140
42from lazr.lifecycle.event import ObjectCreatedEvent
43
44from canonical.cachedproperty import cachedproperty41from canonical.cachedproperty import cachedproperty
45from lp.bugs.browser.bugtask import BugTaskSearchListingView42from lp.bugs.browser.bugtask import BugTaskSearchListingView
46from canonical.launchpad.browser.feeds import (43from canonical.launchpad.browser.feeds import (
@@ -70,7 +67,7 @@
70from lp.registry.interfaces.productseries import IProductSeries67from lp.registry.interfaces.productseries import IProductSeries
71from canonical.launchpad.webapp import (68from canonical.launchpad.webapp import (
72 LaunchpadEditFormView, LaunchpadFormView, LaunchpadView, action,69 LaunchpadEditFormView, LaunchpadFormView, LaunchpadView, action,
73 canonical_url, custom_widget, safe_action, urlappend)70 canonical_url, custom_widget, safe_action)
74from canonical.launchpad.webapp.authorization import check_permission71from canonical.launchpad.webapp.authorization import check_permission
75from canonical.launchpad.webapp.tales import BugTrackerFormatterAPI72from canonical.launchpad.webapp.tales import BugTrackerFormatterAPI
76from canonical.launchpad.validators.name import valid_name_pattern73from canonical.launchpad.validators.name import valid_name_pattern
@@ -1139,11 +1136,13 @@
11391136
1140 series_buglistings = []1137 series_buglistings = []
1141 for series in serieses:1138 for series in serieses:
1142 series_buglistings.append(1139 series_bug_count = series.open_bugtasks.count()
1143 dict(1140 if series_bug_count > 0:
1144 title=series.name,1141 series_buglistings.append(
1145 url=canonical_url(series) + "/+bugs",1142 dict(
1146 count=series.open_bugtasks.count()))1143 title=series.name,
1144 url=canonical_url(series) + "/+bugs",
1145 count=series_bug_count))
11471146
1148 return series_buglistings1147 return series_buglistings
11491148
11501149
=== modified file 'lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt'
--- lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt 2009-06-12 16:36:02 +0000
+++ lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt 2009-08-17 16:41:22 +0000
@@ -5,7 +5,6 @@
5 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")5 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
6 >>> print extract_text(portlet)6 >>> print extract_text(portlet)
7 Series-targeted bugs7 Series-targeted bugs
8 sid 0
9 sarge 18 sarge 1
10 woody 29 woody 2
1110
@@ -13,7 +12,6 @@
13 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")12 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
14 >>> print extract_text(portlet)13 >>> print extract_text(portlet)
15 Series-targeted bugs14 Series-targeted bugs
16 sid 0
17 sarge 115 sarge 1
18 woody 216 woody 2
1917
@@ -21,13 +19,11 @@
21 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")19 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
22 >>> print extract_text(portlet)20 >>> print extract_text(portlet)
23 Series-targeted bugs21 Series-targeted bugs
24 breezy-autotest 0
25 grumpy 0
26 hoary 122 hoary 1
27 warty 123 warty 1
2824
29 >>> print anon_browser.getLink("breezy-autotest").url25 >>> print anon_browser.getLink("hoary").url
30 http://bugs.launchpad.dev/ubuntu/breezy-autotest/+bugs26 http://bugs.launchpad.dev/ubuntu/hoary/+bugs
3127
32The same portlet is available on the bugs homepage for the distro:28The same portlet is available on the bugs homepage for the distro:
3329
@@ -35,7 +31,6 @@
35 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")31 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
36 >>> print extract_text(portlet)32 >>> print extract_text(portlet)
37 Series-targeted bugs33 Series-targeted bugs
38 sid 0
39 sarge 134 sarge 1
40 woody 235 woody 2
4136
@@ -43,7 +38,6 @@
43 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")38 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
44 >>> print extract_text(portlet)39 >>> print extract_text(portlet)
45 Series-targeted bugs40 Series-targeted bugs
46 sid 0
47 sarge 141 sarge 1
48 woody 242 woody 2
4943
@@ -55,26 +49,22 @@
55 >>> print extract_text(portlet)49 >>> print extract_text(portlet)
56 Series-targeted bugs50 Series-targeted bugs
57 1.0 151 1.0 1
58 trunk 0
5952
60 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/1.0/+bugs")53 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/1.0/+bugs")
61 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")54 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
62 >>> print extract_text(portlet)55 >>> print extract_text(portlet)
63 Series-targeted bugs56 Series-targeted bugs
64 1.0 157 1.0 1
65 trunk 0
6658
67 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/+bugs-index")59 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/+bugs-index")
68 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")60 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
69 >>> print extract_text(portlet)61 >>> print extract_text(portlet)
70 Series-targeted bugs62 Series-targeted bugs
71 1.0 163 1.0 1
72 trunk 0
7364
74 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/1.0/+bugs-index")65 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/1.0/+bugs-index")
75 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")66 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
76 >>> print extract_text(portlet)67 >>> print extract_text(portlet)
77 Series-targeted bugs68 Series-targeted bugs
78 1.0 169 1.0 1
79 trunk 0
8070
8171
=== modified file 'lib/lp/bugs/templates/bugtask-portlet-seriesbugs.pt'
--- lib/lp/bugs/templates/bugtask-portlet-seriesbugs.pt 2009-07-17 17:59:07 +0000
+++ lib/lp/bugs/templates/bugtask-portlet-seriesbugs.pt 2009-08-17 16:02:53 +0000
@@ -3,7 +3,8 @@
3 xmlns:metal="http://xml.zope.org/namespaces/metal"3 xmlns:metal="http://xml.zope.org/namespaces/metal"
4 xmlns:i18n="http://xml.zope.org/namespaces/i18n"4 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
5 class="portlet" id="portlet-release-critical-bugs"5 class="portlet" id="portlet-release-critical-bugs"
6 tal:define="series_buglistings view/series_buglistings">6 tal:define="series_buglistings view/series_buglistings"
7 tal:condition="series_buglistings">
78
8 <h2>Series-targeted bugs</h2>9 <h2>Series-targeted bugs</h2>
910