launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06264
[Merge] lp:~adeuring/launchpad/bug-829074-ui into lp:launchpad
Abel Deuring has proposed merging lp:~adeuring/launchpad/bug-829074-ui into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #829074 in Launchpad itself: "Show bugs that are not known to affect "official" upstream"
https://bugs.launchpad.net/launchpad/+bug/829074
For more details, see:
https://code.launchpad.net/~adeuring/launchpad/bug-829074-ui/+merge/91796
This branch fixes bug 829074: Show bugs that are not known to affect
"official" upstream
The already merged branch lp:~adeuring/launchpad/bug-829074 has the
required changes for BugTaskSet.searchTasks(); this branch adds a
minimal set of UI changes: It allows only to select the project
that is linked to a source package via the Packaging table.
I'll extend this quite simple and "narrow" interpretation of
"possibly relevant upstream" in a later branch so that users
can select a arbitrary project, or an upstream SP or DSP. The latter
can be useful when the Ubuntu upstream is not a project but
a Debian package. This should also address the quite similar
bug 232545.
The changes are straightforward:
- A new property BugTaskSearchListingView.upstream_project, which is
the Product linked via the packaging table if the current context
is an SP or DSP.
- A new element in the schema used by BugTaskSearchListingView:
IBugTaskSearch.upstream_target
- new UI elements in the page template.
tests:
./bin/test -vvt lp.bugs.browser.tests.test_buglisting.*test_package
./bin/test -vvt lp.bugs.browser.tests.test_buglisting.*test_upstream_project
./bin/test -vvt lp.bugs.browser.tests.test_buglisting.*test_filter_by_upstream
(I did not add any tests that selecting the upstream project returns the
desired search results -- this is already covered in
lp:~adeuring/launchpad/bug-829074 . But test_filter_by_upstream_target()
ensures that the form parameter field.upstream_target is correctly
"mapped" to BugTaskSearchParams.upstream_target.)
No lint
--
https://code.launchpad.net/~adeuring/launchpad/bug-829074-ui/+merge/91796
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~adeuring/launchpad/bug-829074-ui into lp:launchpad.
=== modified file 'lib/lp/bugs/browser/bugtask.py'
--- lib/lp/bugs/browser/bugtask.py 2012-01-25 05:34:12 +0000
+++ lib/lp/bugs/browser/bugtask.py 2012-02-07 11:04:19 +0000
@@ -2630,14 +2630,13 @@
else:
return 'None specified'
- @property
- def upstream_launchpad_project(self):
+ @cachedproperty
+ def upstream_project(self):
"""The linked upstream `IProduct` for the package.
If this `IBugTarget` is a `IDistributionSourcePackage` or an
- `ISourcePackage` and it is linked to an upstream project that uses
- Launchpad to track bugs, return the `IProduct`. Otherwise,
- return None
+ `ISourcePackage` and it is linked to an upstream project, return
+ the `IProduct`. Otherwise, return None
:returns: `IProduct` or None
"""
@@ -2650,9 +2649,24 @@
if sp is not None:
packaging = sp.packaging
if packaging is not None:
- product = packaging.productseries.product
- if product.bug_tracking_usage == ServiceUsage.LAUNCHPAD:
- return product
+ return packaging.productseries.product
+ return None
+
+ @cachedproperty
+ def upstream_launchpad_project(self):
+ """The linked upstream `IProduct` for the package.
+
+ If this `IBugTarget` is a `IDistributionSourcePackage` or an
+ `ISourcePackage` and it is linked to an upstream project that uses
+ Launchpad to track bugs, return the `IProduct`. Otherwise,
+ return None
+
+ :returns: `IProduct` or None
+ """
+ product = self.upstream_project
+ if (product is not None and
+ product.bug_tracking_usage == ServiceUsage.LAUNCHPAD):
+ return product
return None
@property
=== modified file 'lib/lp/bugs/browser/tests/test_buglisting.py'
--- lib/lp/bugs/browser/tests/test_buglisting.py 2012-01-01 02:58:52 +0000
+++ lib/lp/bugs/browser/tests/test_buglisting.py 2012-02-07 11:04:19 +0000
@@ -467,6 +467,18 @@
bug_target, rootsite='answers', view_name='+addquestion')
self.assertEqual(url, view.addquestion_url)
+ def test_upstream_project(self):
+ # BugTaskSearchListingView.upstream_project and
+ # BugTaskSearchListingView.upstream_launchpad_project are
+ # None for all bug targets except SourcePackages
+ # and DistributionSourcePackages.
+ bug_target = self._makeBugTargetProduct(
+ bug_tracker='launchpad', packaging=True)
+ view = create_initialized_view(
+ bug_target, '+bugs', principal=bug_target.owner)
+ self.assertIs(None, view.upstream_project)
+ self.assertIs(None, view.upstream_launchpad_project)
+
class TestBugTaskSearchListingViewDSP(BugTargetTestCase):
@@ -489,6 +501,7 @@
view = create_initialized_view(
bug_target, '+bugs', principal=upstream_project.owner)
self.assertEqual(upstream_project, view.upstream_launchpad_project)
+ self.assertEqual(upstream_project, view.upstream_project)
content = find_tag_by_id(view.render(), 'also-in-upstream')
link = canonical_url(upstream_project, rootsite='bugs')
self.assertEqual(link, content.a['href'])
@@ -501,6 +514,7 @@
view = create_initialized_view(
bug_target, '+bugs', principal=upstream_project.owner)
self.assertEqual(None, view.upstream_launchpad_project)
+ self.assertEqual(upstream_project, view.upstream_project)
self.assertEqual(None, find_tag_by_id(view(), 'also-in-upstream'))
def test_package_without_upstream_project(self):
@@ -512,8 +526,25 @@
view = create_initialized_view(
bug_target, '+bugs', principal=observer)
self.assertEqual(None, view.upstream_launchpad_project)
+ self.assertEqual(None, view.upstream_project)
self.assertEqual(None, find_tag_by_id(view(), 'also-in-upstream'))
+ def test_filter_by_upstream_target(self):
+ # If an upstream target is specified is the query parameters,
+ # the corresponding flag in BugTaskSearchParams is set.
+ upstream_project = self._makeBugTargetProduct(
+ bug_tracker='launchpad', packaging=True)
+ bug_target = self._getBugTarget(
+ upstream_project.distrosourcepackages[0])
+ form = {
+ 'search': 'Search',
+ 'advanced': 1,
+ 'field.upstream_target': upstream_project.name,
+ }
+ view = create_initialized_view(bug_target, '+bugs', form=form)
+ search_params = view.buildSearchParams()
+ self.assertEqual(upstream_project, search_params.upstream_target)
+
class TestBugTaskSearchListingViewSP(TestBugTaskSearchListingViewDSP):
=== modified file 'lib/lp/bugs/interfaces/bugtask.py'
--- lib/lp/bugs/interfaces/bugtask.py 2012-02-01 17:18:46 +0000
+++ lib/lp/bugs/interfaces/bugtask.py 2012-02-07 11:04:19 +0000
@@ -1066,6 +1066,9 @@
vocabulary=BugTagsSearchCombinator, required=False,
default=BugTagsSearchCombinator.ANY)
+ upstream_target = Choice(
+ title=_('Project'), required=False, vocabulary='Product')
+
class IPersonBugTaskSearch(IBugTaskSearchBase):
"""The schema used by the bug task search form of a person."""
=== modified file 'lib/lp/bugs/templates/bugtask-macros-tableview.pt'
--- lib/lp/bugs/templates/bugtask-macros-tableview.pt 2012-02-01 15:31:32 +0000
+++ lib/lp/bugs/templates/bugtask-macros-tableview.pt 2012-02-07 11:04:19 +0000
@@ -546,15 +546,41 @@
</table>
</fieldset>
- <fieldset tal:condition="view/shouldShowUpstreamStatusBox">
- <legend>Upstream status</legend>
- <table>
- <tr>
- <td style="white-space: nowrap"
- tal:content="structure view/widgets/status_upstream" />
- </tr>
- </table>
- </fieldset>
+ <tal:show_upstream_widgets condition="view/shouldShowUpstreamStatusBox">
+ <fieldset>
+ <legend>Upstream status</legend>
+ <table>
+ <tr>
+ <td style="white-space: nowrap"
+ tal:content="structure view/widgets/status_upstream" />
+ </tr>
+ </table>
+ </fieldset>
+
+ <fieldset tal:condition="view/upstream_project">
+ <legend>Upstream target</legend>
+ <table>
+ <tr>
+ <td style="white-space: nowrap">
+ <label>
+ <input id="field.upstream_target"
+ name="field.upstream_target"
+ value="" checked="checked" class="radioType"
+ type="radio" />
+ All possible upstream targets
+ </label><br />
+ <label>
+ <input id="field.upstream_target"
+ name="field.upstream_target"
+ class="radioType" type="radio"
+ tal:attributes="value view/upstream_project/name" />
+ <span tal:replace="view/upstream_project/displayname" />
+ </label>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </tal:show_upstream_widgets>
<fieldset>
<legend>Bug relationships</legend>