Merge lp:~sinzui/launchpad/nomination-investigation-0 into lp:launchpad

Proposed by Curtis Hovey
Status: Merged
Approved by: j.c.sackett
Approved revision: no longer in the source branch.
Merged at revision: 16138
Proposed branch: lp:~sinzui/launchpad/nomination-investigation-0
Merge into: lp:launchpad
Diff against target: 67 lines (+30/-4)
3 files modified
lib/lp/bugs/browser/bugnomination.py (+6/-3)
lib/lp/bugs/browser/tests/test_bugnomination.py (+22/-0)
lib/lp/bugs/model/bugnomination.py (+2/-1)
To merge this branch: bzr merge lp:~sinzui/launchpad/nomination-investigation-0
Reviewer Review Type Date Requested Status
j.c.sackett (community) Approve
Review via email: mp+129223@code.launchpad.net

Commit message

Fix title, breadcrumbs, and heading on old nomination edit page.

Description of the change

This branch fixes some small issues observed while looking at
BugNomination:+editstatus timeout.

--------------------------------------------------------------------

RULES

    Pre-implementation: no one
    https://bugs.launchpad.net/launchpad/+bug/163490
    * The breadcrumb is always truncated because the text is too long.
      It contains redundant information that comes from the other
      crumbs.
      * Only state the action and the series that is being targeted too.
    * The title property on the view is obsolete. Code and templates
      use label only.

QA

    * Visit https://bugs.qastaging.launchpad.net/gdp/+bug/459328/nominations/55934/+editstatus
    * Verify the page title and breadcrumbs are not truncated.
    * Verify the bread crumbs are
      Review nomination for Gedit Developer Plugins packaging

LINT

    lib/lp/bugs/browser/bugnomination.py
    lib/lp/bugs/browser/tests/test_bugnomination.py
    lib/lp/bugs/model/bugnomination.py

LoC

    I've got a 4.5K credit as of Monday.

TEST

    ./bin/test -vvc lp.bugs.browser.tests.test_bugnomination

IMPLEMENTATION

Replaced the title property with the label property. Provided a sensible
page_title.
    lib/lp/bugs/browser/bugnomination.py
    lib/lp/bugs/browser/tests/test_bugnomination.py

Wrapped a long line.
    lib/lp/bugs/model/bugnomination.py

To post a comment you must log in.
Revision history for this message
j.c.sackett (jcsackett) wrote :

Looks good. Thanks, Curtis.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/browser/bugnomination.py'
2--- lib/lp/bugs/browser/bugnomination.py 2012-01-24 05:10:08 +0000
3+++ lib/lp/bugs/browser/bugnomination.py 2012-10-11 15:43:23 +0000
4@@ -218,11 +218,14 @@
5 field_names = []
6
7 @property
8- def title(self):
9+ def label(self):
10 return 'Approve or decline nomination for bug #%d in %s' % (
11 self.context.bug.id, self.context.target.bugtargetdisplayname)
12- label = title
13- page_title = title
14+
15+ @property
16+ def page_title(self):
17+ text = 'Review nomination for %s'
18+ return text % self.context.target.bugtargetdisplayname
19
20 def initialize(self):
21 self.current_bugtask = getUtility(ILaunchBag).bugtask
22
23=== modified file 'lib/lp/bugs/browser/tests/test_bugnomination.py'
24--- lib/lp/bugs/browser/tests/test_bugnomination.py 2012-08-16 05:18:54 +0000
25+++ lib/lp/bugs/browser/tests/test_bugnomination.py 2012-10-11 15:43:23 +0000
26@@ -240,6 +240,28 @@
27 ).request.response.getStatus())
28 self.assertTrue(nomination.isApproved())
29
30+ def test_label(self):
31+ nomination = self.getNomination()
32+ target = nomination.target
33+ view = self.getNominationEditView(nomination, {})
34+ self.assertEqual(
35+ 'Approve or decline nomination for bug #%d in %s' % (
36+ nomination.bug.id, target.bugtargetdisplayname),
37+ view.label)
38+
39+ def test_page_title(self):
40+ nomination = self.getNomination()
41+ target = nomination.target
42+ view = self.getNominationEditView(nomination, {})
43+ self.assertEqual(
44+ 'Review nomination for %s' % target.bugtargetdisplayname,
45+ view.page_title)
46+
47+ def test_next_url(self):
48+ nomination = self.getNomination()
49+ view = self.getNominationEditView(nomination, {})
50+ self.assertEqual(canonical_url(view.current_bugtask), view.next_url)
51+
52 def test_approving_twice_is_noop(self):
53 nomination = self.getNomination()
54 self.assertApproves(nomination)
55
56=== modified file 'lib/lp/bugs/model/bugnomination.py'
57--- lib/lp/bugs/model/bugnomination.py 2012-05-11 02:39:08 +0000
58+++ lib/lp/bugs/model/bugnomination.py 2012-10-11 15:43:23 +0000
59@@ -93,7 +93,8 @@
60 targets.append(distroseries)
61 else:
62 targets.append(self.productseries)
63- bugtasks = getUtility(IBugTaskSet).createManyTasks(self.bug, approver, targets)
64+ bugtasks = getUtility(IBugTaskSet).createManyTasks(
65+ self.bug, approver, targets)
66 for bug_task in bugtasks:
67 self.bug.addChange(BugTaskAdded(UTC_NOW, approver, bug_task))
68