Code review comment for lp:~deryck/launchpad/filebug-redirect-package-oops-435628

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.

« Back to merge proposal