Merge lp:~deryck/launchpad/filebug-redirect-package-oops-435628 into lp:launchpad/db-devel

Proposed by Deryck Hodge
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~deryck/launchpad/filebug-redirect-package-oops-435628
Merge into: lp:launchpad/db-devel
Diff against target: 49 lines
2 files modified
lib/lp/bugs/browser/bugtarget.py (+9/-2)
lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt (+7/-0)
To merge this branch: bzr merge lp:~deryck/launchpad/filebug-redirect-package-oops-435628
Reviewer Review Type Date Requested Status
William Grant Approve
Brad Crittenden (community) release-critical Approve
Paul Hummer (community) Approve
Review via email: mp+12366@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

This is the fix for bug 435628, which reports an oops for filebug pages for Ubuntu source packages. The fix is to check for bug_supervisor only for IDistribution.

Revision history for this message
Paul Hummer (rockstar) :
review: Approve
Revision history for this message
Brad Crittenden (bac) :
review: Approve (release-critical)
Revision history for this message
William Grant (wgrant) wrote :

That's not the right fix. Members of the bug supervisor will almost always know the package against which they want to file a bug, so this basically breaks the whole point of the bug supervisor exclusion.

The correct fix is to always check for membership in the Distribution's bug supervisor, even if the context is a SourcePackage or DistributionSourcePackage.

review: Needs Fixing
Revision history for this message
Deryck Hodge (deryck) wrote :

Here's an updated diff, with the correct fix, I hope.

=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py 2009-09-24 16:33:25 +0000
+++ lib/lp/bugs/browser/bugtarget.py 2009-09-25 00:59:30 +0000
@@ -67,6 +67,7 @@
 from lp.registry.interfaces.distroseries import IDistroSeries
 from lp.registry.interfaces.product import IProduct, IProject
 from lp.registry.interfaces.productseries import IProductSeries
+from lp.registry.interfaces.sourcepackage import ISourcePackage
 from canonical.launchpad.webapp import (
     LaunchpadEditFormView, LaunchpadFormView, LaunchpadView, action,
     canonical_url, custom_widget, safe_action)
@@ -350,16 +351,16 @@
     @property
     def no_ubuntu_redirect(self):
         if IDistribution.providedBy(self.context):
- return (
- self.request.form.get('no-redirect') is not None or
- [key for key in self.request.form.keys()
- if 'field.actions' in key] != [] or
- self.user.inTeam(self.context.bug_supervisor))
- else:
- return (
- self.request.form.get('no-redirect') is not None or
- [key for key in self.request.form.keys()
- if 'field.actions' in key] != [])
+ bug_supervisor = self.context.bug_supervisor
+ elif (IDistributionSourcePackage.providedBy(self.context) or
+ ISourcePackage.providedBy(self.context)):
+ bug_supervisor = self.context.distribution.bug_supervisor
+
+ return (
+ self.request.form.get('no-redirect') is not None or
+ [key for key in self.request.form.keys()
+ if 'field.actions' in key] != [] or
+ self.user.inTeam(bug_supervisor))

     def getPackageNameFieldCSSClass(self):
         """Return the CSS class for the packagename field."""

=== modified file 'lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt'
--- lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt 2009-09-24 16:33:25 +0000
+++ lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt 2009-09-25 00:35:07 +0000
@@ -57,14 +57,12 @@
     >>> print admin_browser.title
     Report a bug about Ubuntu...

-The bug supervisor is considered only for the distribution itself,
-not for a source package. Source packages should still redirect,
-regardless of the user being Ubuntu's bug supervisor.
+Source packages are also not redirected for Ubuntu's bug supervisor.

     >>> admin_browser.open(
     ... 'http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox/+filebug')
     >>> print admin_browser.url
- http://launchpad.dev/+tour/index
+ http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox/+filebug

 Filing bugs with Apport also allows us to get to the bug filing interface.

Revision history for this message
William Grant (wgrant) wrote :

I haven't tested it, but that looks good to me.

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-09-23 15:18:48 +0000
3+++ lib/lp/bugs/browser/bugtarget.py 2009-09-25 01:09:13 +0000
4@@ -67,6 +67,7 @@
5 from lp.registry.interfaces.distroseries import IDistroSeries
6 from lp.registry.interfaces.product import IProduct, IProject
7 from lp.registry.interfaces.productseries import IProductSeries
8+from lp.registry.interfaces.sourcepackage import ISourcePackage
9 from canonical.launchpad.webapp import (
10 LaunchpadEditFormView, LaunchpadFormView, LaunchpadView, action,
11 canonical_url, custom_widget, safe_action)
12@@ -349,11 +350,17 @@
13
14 @property
15 def no_ubuntu_redirect(self):
16+ if IDistribution.providedBy(self.context):
17+ bug_supervisor = self.context.bug_supervisor
18+ elif (IDistributionSourcePackage.providedBy(self.context) or
19+ ISourcePackage.providedBy(self.context)):
20+ bug_supervisor = self.context.distribution.bug_supervisor
21+
22 return (
23 self.request.form.get('no-redirect') is not None or
24 [key for key in self.request.form.keys()
25- if 'field.actions' in key] != [] or
26- self.user.inTeam(self.context.bug_supervisor))
27+ if 'field.actions' in key] != [] or
28+ self.user.inTeam(bug_supervisor))
29
30 def getPackageNameFieldCSSClass(self):
31 """Return the CSS class for the packagename field."""
32
33=== modified file 'lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt'
34--- lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt 2009-09-23 10:08:05 +0000
35+++ lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt 2009-09-25 01:09:13 +0000
36@@ -57,6 +57,13 @@
37 >>> print admin_browser.title
38 Report a bug about Ubuntu...
39
40+Source packages are also not redirected for Ubuntu's bug supervisor.
41+
42+ >>> admin_browser.open(
43+ ... 'http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox/+filebug')
44+ >>> print admin_browser.url
45+ http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox/+filebug
46+
47 Filing bugs with Apport also allows us to get to the bug filing interface.
48
49 >>> import os.path

Subscribers

People subscribed via source and target branches

to status/vote changes: