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
1=== modified file 'lib/lp/bugs/browser/bugtarget.py'
2--- lib/lp/bugs/browser/bugtarget.py 2009-07-27 14:14:53 +0000
3+++ lib/lp/bugs/browser/bugtarget.py 2009-08-17 17:09:23 +0000
4@@ -31,7 +31,6 @@
5 from zope.app.form.browser import TextWidget
6 from zope.app.form.interfaces import InputErrors
7 from zope.component import getUtility
8-from zope.event import notify
9 from zope import formlib
10 from zope.interface import implements
11 from zope.publisher.interfaces import NotFound
12@@ -39,8 +38,6 @@
13 from zope.schema import Choice
14 from zope.schema.vocabulary import SimpleVocabulary
15
16-from lazr.lifecycle.event import ObjectCreatedEvent
17-
18 from canonical.cachedproperty import cachedproperty
19 from lp.bugs.browser.bugtask import BugTaskSearchListingView
20 from canonical.launchpad.browser.feeds import (
21@@ -70,7 +67,7 @@
22 from lp.registry.interfaces.productseries import IProductSeries
23 from canonical.launchpad.webapp import (
24 LaunchpadEditFormView, LaunchpadFormView, LaunchpadView, action,
25- canonical_url, custom_widget, safe_action, urlappend)
26+ canonical_url, custom_widget, safe_action)
27 from canonical.launchpad.webapp.authorization import check_permission
28 from canonical.launchpad.webapp.tales import BugTrackerFormatterAPI
29 from canonical.launchpad.validators.name import valid_name_pattern
30@@ -1139,11 +1136,13 @@
31
32 series_buglistings = []
33 for series in serieses:
34- series_buglistings.append(
35- dict(
36- title=series.name,
37- url=canonical_url(series) + "/+bugs",
38- count=series.open_bugtasks.count()))
39+ series_bug_count = series.open_bugtasks.count()
40+ if series_bug_count > 0:
41+ series_buglistings.append(
42+ dict(
43+ title=series.name,
44+ url=canonical_url(series) + "/+bugs",
45+ count=series_bug_count))
46
47 return series_buglistings
48
49
50=== modified file 'lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt'
51--- lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt 2009-06-12 16:36:02 +0000
52+++ lib/lp/bugs/stories/bugs/xx-portlets-bug-series.txt 2009-08-17 16:41:22 +0000
53@@ -5,7 +5,6 @@
54 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
55 >>> print extract_text(portlet)
56 Series-targeted bugs
57- sid 0
58 sarge 1
59 woody 2
60
61@@ -13,7 +12,6 @@
62 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
63 >>> print extract_text(portlet)
64 Series-targeted bugs
65- sid 0
66 sarge 1
67 woody 2
68
69@@ -21,13 +19,11 @@
70 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
71 >>> print extract_text(portlet)
72 Series-targeted bugs
73- breezy-autotest 0
74- grumpy 0
75 hoary 1
76 warty 1
77
78- >>> print anon_browser.getLink("breezy-autotest").url
79- http://bugs.launchpad.dev/ubuntu/breezy-autotest/+bugs
80+ >>> print anon_browser.getLink("hoary").url
81+ http://bugs.launchpad.dev/ubuntu/hoary/+bugs
82
83 The same portlet is available on the bugs homepage for the distro:
84
85@@ -35,7 +31,6 @@
86 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
87 >>> print extract_text(portlet)
88 Series-targeted bugs
89- sid 0
90 sarge 1
91 woody 2
92
93@@ -43,7 +38,6 @@
94 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
95 >>> print extract_text(portlet)
96 Series-targeted bugs
97- sid 0
98 sarge 1
99 woody 2
100
101@@ -55,26 +49,22 @@
102 >>> print extract_text(portlet)
103 Series-targeted bugs
104 1.0 1
105- trunk 0
106
107 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/1.0/+bugs")
108 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
109 >>> print extract_text(portlet)
110 Series-targeted bugs
111 1.0 1
112- trunk 0
113
114 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/+bugs-index")
115 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
116 >>> print extract_text(portlet)
117 Series-targeted bugs
118 1.0 1
119- trunk 0
120
121 >>> anon_browser.open("http://bugs.launchpad.dev/firefox/1.0/+bugs-index")
122 >>> portlet = find_portlet(anon_browser.contents, "Series-targeted bugs")
123 >>> print extract_text(portlet)
124 Series-targeted bugs
125 1.0 1
126- trunk 0
127
128
129=== modified file 'lib/lp/bugs/templates/bugtask-portlet-seriesbugs.pt'
130--- lib/lp/bugs/templates/bugtask-portlet-seriesbugs.pt 2009-07-17 17:59:07 +0000
131+++ lib/lp/bugs/templates/bugtask-portlet-seriesbugs.pt 2009-08-17 16:02:53 +0000
132@@ -3,7 +3,8 @@
133 xmlns:metal="http://xml.zope.org/namespaces/metal"
134 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
135 class="portlet" id="portlet-release-critical-bugs"
136- tal:define="series_buglistings view/series_buglistings">
137+ tal:define="series_buglistings view/series_buglistings"
138+ tal:condition="series_buglistings">
139
140 <h2>Series-targeted bugs</h2>
141