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
=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py 2009-09-23 15:18:48 +0000
+++ lib/lp/bugs/browser/bugtarget.py 2009-09-25 01:09:13 +0000
@@ -67,6 +67,7 @@
67from lp.registry.interfaces.distroseries import IDistroSeries67from lp.registry.interfaces.distroseries import IDistroSeries
68from lp.registry.interfaces.product import IProduct, IProject68from lp.registry.interfaces.product import IProduct, IProject
69from lp.registry.interfaces.productseries import IProductSeries69from lp.registry.interfaces.productseries import IProductSeries
70from lp.registry.interfaces.sourcepackage import ISourcePackage
70from canonical.launchpad.webapp import (71from canonical.launchpad.webapp import (
71 LaunchpadEditFormView, LaunchpadFormView, LaunchpadView, action,72 LaunchpadEditFormView, LaunchpadFormView, LaunchpadView, action,
72 canonical_url, custom_widget, safe_action)73 canonical_url, custom_widget, safe_action)
@@ -349,11 +350,17 @@
349350
350 @property351 @property
351 def no_ubuntu_redirect(self):352 def no_ubuntu_redirect(self):
353 if IDistribution.providedBy(self.context):
354 bug_supervisor = self.context.bug_supervisor
355 elif (IDistributionSourcePackage.providedBy(self.context) or
356 ISourcePackage.providedBy(self.context)):
357 bug_supervisor = self.context.distribution.bug_supervisor
358
352 return (359 return (
353 self.request.form.get('no-redirect') is not None or360 self.request.form.get('no-redirect') is not None or
354 [key for key in self.request.form.keys()361 [key for key in self.request.form.keys()
355 if 'field.actions' in key] != [] or362 if 'field.actions' in key] != [] or
356 self.user.inTeam(self.context.bug_supervisor))363 self.user.inTeam(bug_supervisor))
357364
358 def getPackageNameFieldCSSClass(self):365 def getPackageNameFieldCSSClass(self):
359 """Return the CSS class for the packagename field."""366 """Return the CSS class for the packagename field."""
360367
=== modified file 'lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt'
--- lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt 2009-09-23 10:08:05 +0000
+++ lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt 2009-09-25 01:09:13 +0000
@@ -57,6 +57,13 @@
57 >>> print admin_browser.title57 >>> print admin_browser.title
58 Report a bug about Ubuntu...58 Report a bug about Ubuntu...
5959
60Source packages are also not redirected for Ubuntu's bug supervisor.
61
62 >>> admin_browser.open(
63 ... 'http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox/+filebug')
64 >>> print admin_browser.url
65 http://bugs.launchpad.dev/ubuntu/+source/mozilla-firefox/+filebug
66
60Filing bugs with Apport also allows us to get to the bug filing interface.67Filing bugs with Apport also allows us to get to the bug filing interface.
6168
62 >>> import os.path69 >>> import os.path

Subscribers

People subscribed via source and target branches

to status/vote changes: