Merge lp:~deryck/launchpad/wrong-bug-number-edit-page-439449 into lp:launchpad

Proposed by Deryck Hodge
Status: Merged
Approved by: Gavin Panella
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~deryck/launchpad/wrong-bug-number-edit-page-439449
Merge into: lp:launchpad
Diff against target: 41 lines
2 files modified
lib/lp/bugs/browser/bug.py (+2/-1)
lib/lp/bugs/stories/bugs/xx-bug-edit.txt (+11/-0)
To merge this branch: bzr merge lp:~deryck/launchpad/wrong-bug-number-edit-page-439449
Reviewer Review Type Date Requested Status
Michael Nelson (community) release-critical Approve
Gavin Panella (community) Approve
Review via email: mp+14224@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

This fixes bug 439449. We were using bugtask.id instead of bug.id on
title and heading (label and page_title) for a bug's +edit page.

I added a small test to cover that the correct bug ID is displayed, too.

./bin/test -vv -t xx-bug-edit.txt

= 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/bug.py
  lib/lp/bugs/stories/bugs/xx-bug-edit.txt

== Pylint notices ==

lib/lp/bugs/browser/bug.py
    44: [F0401] Unable to import 'lazr.enum' (No module named enum)
    45: [F0401] Unable to import 'lazr.lifecycle.event' (No module named
lifecycle)
    46: [F0401] Unable to import 'lazr.lifecycle.snapshot' (No module
named lifecycle)
    47: [F0401] Unable to import 'lazr.restful.interfaces' (No module
named restful)

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

<allenap> deryck: Perhaps add a comment to BugEditView.__init__ saying that context is always an IBugTask.
<deryck> allenap, sure, I can do that.

review: Approve
Revision history for this message
Michael Nelson (michael.nelson) wrote :

OK, given this is very small and persuaded that it's quite important :)

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/bug.py'
2--- lib/lp/bugs/browser/bug.py 2009-10-26 14:33:26 +0000
3+++ lib/lp/bugs/browser/bug.py 2009-10-30 16:31:13 +0000
4@@ -560,13 +560,14 @@
5 _confirm_new_tags = False
6
7 def __init__(self, context, request):
8+ """context is always an IBugTask."""
9 BugEditViewBase.__init__(self, context, request)
10 self.notifications = []
11
12 @property
13 def label(self):
14 """The form label."""
15- return 'Edit details for bug #%d' % self.context.id
16+ return 'Edit details for bug #%d' % self.context.bug.id
17
18 @property
19 def page_title(self):
20
21=== modified file 'lib/lp/bugs/stories/bugs/xx-bug-edit.txt'
22--- lib/lp/bugs/stories/bugs/xx-bug-edit.txt 2009-08-12 11:49:59 +0000
23+++ lib/lp/bugs/stories/bugs/xx-bug-edit.txt 2009-10-30 16:31:13 +0000
24@@ -13,6 +13,17 @@
25 ...
26 ...blackhole is already in use by another bug...
27
28+The user should be able to look at the page title or heading and
29+see the bug number being edited.
30+
31+ >>> user_browser.open(
32+ ... 'http://bugs.launchpad.dev/jokosher/+bug/11/+edit')
33+ >>> print user_browser.title
34+ Edit details for bug #11 ...
35+ >>> main = find_main_content(user_browser.contents)
36+ >>> print extract_text(main.h1)
37+ Edit details for bug #11
38+
39 And now we show that any logged-in user can edit public bugs.
40
41 >>> browser = setupBrowser(auth='Basic no-priv@canonical.com:test')