Merge lp:~deryck/launchpad/not-implemented-errors into lp:launchpad

Proposed by Deryck Hodge on 2010-01-29
Status: Merged
Approved by: Deryck Hodge on 2010-01-29
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~deryck/launchpad/not-implemented-errors
Merge into: lp:launchpad
Diff against target: 43 lines (+23/-0)
2 files modified
lib/lp/bugs/browser/bugtarget.py (+12/-0)
lib/lp/bugs/windmill/tests/test_filebug_dupe_finder.py (+11/-0)
To merge this branch: bzr merge lp:~deryck/launchpad/not-implemented-errors
Reviewer Review Type Date Requested Status
Francis J. Lacoste (community) release-critical Approve on 2010-02-17
Paul Hummer (community) 2010-01-29 Approve on 2010-01-29
Review via email: mp+18283@code.launchpad.net

Commit Message

Fix NotImplementedError OPPS when filing a bug by ensuring errors are displayed on filebug page.

To post a comment you must log in.
Deryck Hodge (deryck) wrote :

This is a fix for bug 508302, which describes the problems we've been
having with NotImplementedError OPPS on filing a bug.

The error was introduced when we changed the filebug page to use an
inline JavaScript dupe search. The inline submit bug form used a
different view to process the form submission, which didn't implement
the showFileBugForm method.

To fix this, I simply changed the action on the form to match +filebug
pages, so that any validation errors would be displayed back to the user.

== Tests ==

I updated a Windmill test to test that a single error displays on the
web page. The story test didn't fail because the non-JavaScript version
of the pages used the +filebug view, rather than the inline form. (This
also seemed to make the case for having the inline form use the same
action url.)

To test, run:

./bin/test --layer=BugsWindmillLayer -cvv -t test_filebug_dupe_finder

== Demo and Q/A ==

To demo in a browser, go to any +filebug page and submit the form
without filling in the description input. You should see the page
reload and display the form validation error.

Finally...

I must admit, I have no idea how to fix these lint errors. Nothing I
tried would work.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/bugs/browser/bugtarget.py
  lib/lp/bugs/windmill/tests/test_filebug_dupe_finder.py

== Pylint notices ==

lib/lp/bugs/browser/bugtarget.py
    495: [C0322, FileBugViewBase.submit_bug_action] Operator not
preceded by a space
    failure=handleSubmitBugFailure)
    ^
    def submit_bug_action(self, action, data):
    673: [C0322, FileBugViewBase.this_is_my_bug_action] Operator not
preceded by a space
    name="this_is_my_bug", failure=handleSubmitBugFailure)
    ^
    def this_is_my_bug_action(self, action, data):
    1045: [C0322, FileBugGuidedView.continue_action] Operator not
preceded by a space
    validator="validate_no_dupe_found")
    ^
    def continue_action(self, action, data):

Paul Hummer (rockstar) :
review: Approve
review: Approve (release-critical)

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 2010-01-26 14:22:41 +0000
3+++ lib/lp/bugs/browser/bugtarget.py 2010-01-29 19:40:32 +0000
4@@ -896,6 +896,18 @@
5 show_summary_in_results = False
6
7 @property
8+ def action_url(self):
9+ """Return the +filebug page as the action URL.
10+
11+ This enables better validation error handling,
12+ since the form is always used inline on the +filebug page.
13+ """
14+ url = '%s/+filebug' % canonical_url(self.context)
15+ if self.extra_data_token is not None:
16+ url = urlappend(url, self.extra_data_token)
17+ return url
18+
19+ @property
20 def search_context(self):
21 """Return the context used to search for similar bugs."""
22 return self.context
23
24=== modified file 'lib/lp/bugs/windmill/tests/test_filebug_dupe_finder.py'
25--- lib/lp/bugs/windmill/tests/test_filebug_dupe_finder.py 2009-12-14 13:24:07 +0000
26+++ lib/lp/bugs/windmill/tests/test_filebug_dupe_finder.py 2010-01-29 19:40:32 +0000
27@@ -105,5 +105,16 @@
28 client.waits.sleep(milliseconds=constants.SLEEP)
29 client.asserts.assertElemJS(xpath=FORM_OVERLAY, js=FORM_NOT_VISIBLE)
30
31+ # Validation errors are displayed on the current page.
32+ client.click(id="bug-not-already-reported")
33+ client.asserts.assertProperty(
34+ id="filebug-form-container", validator="style.display|block",
35+ timeout=constants.FOR_ELEMENT)
36+ client.click(id="field.actions.submit_bug")
37+ client.waits.forPageLoad(timeout=constants.PAGE_LOAD)
38+ client.asserts.assertText(
39+ xpath=u'//div[@class="message"]',
40+ validator="Required input is missing.")
41+
42 def test_suite():
43 return unittest.TestLoader().loadTestsFromName(__name__)