Merge lp:~gmb/launchpad/ubuntu-filebug-dupefinder-bug-497096 into lp:launchpad/db-devel

Proposed by Graham Binns
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~gmb/launchpad/ubuntu-filebug-dupefinder-bug-497096
Merge into: lp:launchpad/db-devel
Diff against target: 112 lines (+48/-25)
2 files modified
lib/lp/bugs/browser/bugtarget.py (+34/-25)
lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt (+14/-0)
To merge this branch: bzr merge lp:~gmb/launchpad/ubuntu-filebug-dupefinder-bug-497096
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Данило Шеган (community) release-critical Approve
Gavin Panella code Pending
Review via email: mp+16230@code.launchpad.net

Commit message

The +filebug inline dupe finder will now work for the Ubuntu +filebug form.

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) wrote :

This branch fixes bug 497096 by moving the Ubuntu +filebug redirect code into FileBugGuidedView, which is where it actually gets used. This means that sundry +filebug views (+filebug-inline-form, +filebug-show-similar and so on) shouldn't redirect, which means that the inline dupe finder will now work.

You can QA this on lp.dev by setting ubuntu_disable_filebug to True in configs/development/launchpad-lazr.conf and hitting ubuntu/+filebug with ?no-redirect=1 in the query string. The dupe finder should Just Work.

Revision history for this message
Данило Шеган (danilo) wrote :

Mostly moved code to the appropriate view. Do get another review, and please confirm there's a test that redirect keeps working where it should. Also, don't forget the QA before landing, because there won't be enough time to QA after this lands.

review: Approve (release-critical)
Revision history for this message
Gavin Panella (allenap) wrote :

<allenap> gmb: Should lines 20 to 33 also be moving?
<gmb> allenap: Eh... Hmm. Well, it passes the tests ;). But no, probably not. I'll move those back.
<gmb> allenap: Although that gets a bit knotty then...
<gmb> allenap: No, I'll move it back, because otherwise it will have nasty effects on the other +filebug views when extra data get passed.

review: Approve
Revision history for this message
Graham Binns (gmb) wrote :
Download full text (4.2 KiB)

I had to do a slight refactor to make the fix that Gavin and I agreed on:

=== modified file 'lib/lp/bugs/browser/bugtarget.py'
--- lib/lp/bugs/browser/bugtarget.py 2009-12-16 08:13:19 +0000
+++ lib/lp/bugs/browser/bugtarget.py 2009-12-16 09:38:58 +0000
@@ -270,6 +270,44 @@
         LaunchpadFormView.__init__(self, context, request)
         self.extra_data = FileBugData()

+ def initialize(self):
+ LaunchpadFormView.initialize(self)
+ if (not self.redirect_ubuntu_filebug and
+ self.extra_data_token is not None):
+ # self.extra_data has been initialized in publishTraverse().
+ if self.extra_data.initial_summary:
+ self.widgets['title'].setRenderedValue(
+ self.extra_data.initial_summary)
+ if self.extra_data.initial_tags:
+ self.widgets['tags'].setRenderedValue(
+ self.extra_data.initial_tags)
+ # XXX: Bjorn Tillenius 2006-01-15:
+ # We should include more details of what will be added
+ # to the bug report.
+ self.request.response.addNotification(
+ 'Extra debug information will be added to the bug report'
+ ' automatically.')
+
+ @cachedproperty
+ def redirect_ubuntu_filebug(self):
+ if IDistribution.providedBy(self.context):
+ bug_supervisor = self.context.bug_supervisor
+ elif (IDistributionSourcePackage.providedBy(self.context) or
+ ISourcePackage.providedBy(self.context)):
+ bug_supervisor = self.context.distribution.bug_supervisor
+
+ # Work out whether the redirect should be overidden.
+ do_not_redirect = (
+ 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))
+
+ return (
+ config.malone.ubuntu_disable_filebug and
+ self.targetIsUbuntu() and
+ self.extra_data_token is None and
+ not do_not_redirect)

     @property
     def field_names(self):
@@ -928,45 +966,13 @@
     show_summary_in_results = True

     def initialize(self):
- LaunchpadFormView.initialize(self)
-
- if (config.malone.ubuntu_disable_filebug and
- self.targetIsUbuntu() and
- self.extra_data_token is None and
- not self.no_ubuntu_redirect):
+ FilebugShowSimilarBugsView.initialize(self)
+ if self.redirect_ubuntu_filebug:
             # The user is trying to file a new Ubuntu bug via the web
             # interface and without using apport. Redirect to a page
             # explaining the preferred bug-filing procedure.
             self.request.response.redirect(
                 config.malone.ubuntu_bug_filing_url)
- if self.extra_data_token is not None:
- # self.extra_data has been initialized in publishTraverse().
- if self.extra_data.initial_summary:
- self.widgets['title'].setRenderedValue(
- self.extra_data.initial_summary)
- if self.extra_dat...

Read more...

Revision history for this message
Gavin Panella (allenap) wrote :

 review approve
 merge approve

review: Approve
Revision history for this message
Graham Binns (gmb) wrote :

FTR, Gavin has approved the incremental diff; he's managed to break this merge proposal so that he can't add anything to it. Well done, Gavin.

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-12-11 10:58:46 +0000
+++ lib/lp/bugs/browser/bugtarget.py 2009-12-16 10:34:17 +0000
@@ -272,17 +272,8 @@
272272
273 def initialize(self):273 def initialize(self):
274 LaunchpadFormView.initialize(self)274 LaunchpadFormView.initialize(self)
275275 if (not self.redirect_ubuntu_filebug and
276 if (config.malone.ubuntu_disable_filebug and276 self.extra_data_token is not None):
277 self.targetIsUbuntu() and
278 self.extra_data_token is None and
279 not self.no_ubuntu_redirect):
280 # The user is trying to file a new Ubuntu bug via the web
281 # interface and without using apport. Redirect to a page
282 # explaining the preferred bug-filing procedure.
283 self.request.response.redirect(
284 config.malone.ubuntu_bug_filing_url)
285 if self.extra_data_token is not None:
286 # self.extra_data has been initialized in publishTraverse().277 # self.extra_data has been initialized in publishTraverse().
287 if self.extra_data.initial_summary:278 if self.extra_data.initial_summary:
288 self.widgets['title'].setRenderedValue(279 self.widgets['title'].setRenderedValue(
@@ -297,6 +288,29 @@
297 'Extra debug information will be added to the bug report'288 'Extra debug information will be added to the bug report'
298 ' automatically.')289 ' automatically.')
299290
291 @cachedproperty
292 def redirect_ubuntu_filebug(self):
293 if IDistribution.providedBy(self.context):
294 bug_supervisor = self.context.bug_supervisor
295 elif (IDistributionSourcePackage.providedBy(self.context) or
296 ISourcePackage.providedBy(self.context)):
297 bug_supervisor = self.context.distribution.bug_supervisor
298 else:
299 bug_supervisor = None
300
301 # Work out whether the redirect should be overidden.
302 do_not_redirect = (
303 self.request.form.get('no-redirect') is not None or
304 [key for key in self.request.form.keys()
305 if 'field.actions' in key] != [] or
306 self.user.inTeam(bug_supervisor))
307
308 return (
309 config.malone.ubuntu_disable_filebug and
310 self.targetIsUbuntu() and
311 self.extra_data_token is None and
312 not do_not_redirect)
313
300 @property314 @property
301 def field_names(self):315 def field_names(self):
302 """Return the list of field names to display."""316 """Return the list of field names to display."""
@@ -346,20 +360,6 @@
346 self.request.form.get('field.bugtarget.distribution') ==360 self.request.form.get('field.bugtarget.distribution') ==
347 ubuntu.name))361 ubuntu.name))
348362
349 @property
350 def no_ubuntu_redirect(self):
351 if IDistribution.providedBy(self.context):
352 bug_supervisor = self.context.bug_supervisor
353 elif (IDistributionSourcePackage.providedBy(self.context) or
354 ISourcePackage.providedBy(self.context)):
355 bug_supervisor = self.context.distribution.bug_supervisor
356
357 return (
358 self.request.form.get('no-redirect') is not None or
359 [key for key in self.request.form.keys()
360 if 'field.actions' in key] != [] or
361 self.user.inTeam(bug_supervisor))
362
363 def getPackageNameFieldCSSClass(self):363 def getPackageNameFieldCSSClass(self):
364 """Return the CSS class for the packagename field."""364 """Return the CSS class for the packagename field."""
365 if self.widget_errors.get("packagename"):365 if self.widget_errors.get("packagename"):
@@ -967,6 +967,15 @@
967 focused_element_id = 'field.title'967 focused_element_id = 'field.title'
968 show_summary_in_results = True968 show_summary_in_results = True
969969
970 def initialize(self):
971 FilebugShowSimilarBugsView.initialize(self)
972 if self.redirect_ubuntu_filebug:
973 # The user is trying to file a new Ubuntu bug via the web
974 # interface and without using apport. Redirect to a page
975 # explaining the preferred bug-filing procedure.
976 self.request.response.redirect(
977 config.malone.ubuntu_bug_filing_url)
978
970 @safe_action979 @safe_action
971 @action("Continue", name="search", validator="validate_search")980 @action("Continue", name="search", validator="validate_search")
972 def search_action(self, action, data):981 def search_action(self, action, data):
973982
=== modified file 'lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt'
--- lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt 2009-10-20 13:26:19 +0000
+++ lib/lp/bugs/stories/guided-filebug/xx-ubuntu-filebug.txt 2009-12-16 10:34:17 +0000
@@ -81,3 +81,17 @@
8181
82 >>> _ = config.pop('malone')82 >>> _ = config.pop('malone')
8383
84The inline filebug form never gets redirected.
85
86 >>> user_browser.open(
87 ... 'http://bugs.launchpad.dev/ubuntu/+filebug-inline-form')
88 >>> print user_browser.url
89 http://bugs.launchpad.dev/ubuntu/+filebug-inline-form
90
91Neither does the show-similar-bugs view.
92
93 >>> user_browser.open(
94 ... 'http://bugs.launchpad.dev/ubuntu/'
95 ... '+filebug-show-similar?title=testing')
96 >>> print user_browser.url
97 http://bugs.launchpad.dev/ubuntu/+filebug-show-similar?title=testing

Subscribers

People subscribed via source and target branches

to status/vote changes: