Merge lp:~mwhudson/launchpad/no-project-in-ui-bug-409655 into lp:launchpad

Proposed by Michael Hudson-Doyle
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: not available
Merged at revision: not available
Proposed branch: lp:~mwhudson/launchpad/no-project-in-ui-bug-409655
Merge into: lp:launchpad
Diff against target: 51 lines (+11/-2)
2 files modified
lib/canonical/launchpad/xmlrpc/faults.py (+8/-1)
lib/lp/code/xmlrpc/tests/test_branch.py (+3/-1)
To merge this branch: bzr merge lp:~mwhudson/launchpad/no-project-in-ui-bug-409655
Reviewer Review Type Date Requested Status
Tim Penhey (community) Approve
Review via email: mp+19828@code.launchpad.net

Commit message

Don't refer to 'project' in error message for say lp:mysql when we mean 'project group'

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/xmlrpc/faults.py'
2--- lib/canonical/launchpad/xmlrpc/faults.py 2009-11-12 06:28:08 +0000
3+++ lib/canonical/launchpad/xmlrpc/faults.py 2010-02-21 22:18:18 +0000
4@@ -44,6 +44,9 @@
5 import xmlrpclib
6
7
8+from lp.registry.interfaces.projectgroup import IProjectGroup
9+
10+
11 def check_fault(fault, *fault_classes):
12 """Check if 'fault's faultCode matches any of 'fault_classes'.
13
14@@ -312,9 +315,13 @@
15 "%(component_type)s cannot have a default branch.")
16
17 def __init__(self, component):
18+ if IProjectGroup.providedBy(component):
19+ component_type = 'project group'
20+ else:
21+ component_type = component.__class__.__name__.lower()
22 LaunchpadFault.__init__(
23 self, component_name=component.displayname,
24- component_type=component.__class__.__name__.lower())
25+ component_type=component_type)
26
27
28 class InvalidProductIdentifier(LaunchpadFault):
29
30=== modified file 'lib/lp/code/xmlrpc/tests/test_branch.py'
31--- lib/lp/code/xmlrpc/tests/test_branch.py 2009-11-12 04:28:28 +0000
32+++ lib/lp/code/xmlrpc/tests/test_branch.py 2010-02-21 22:18:18 +0000
33@@ -73,6 +73,7 @@
34 % (lp_url_path, fault))
35 self.assertEqual(expected_fault.__class__, fault.__class__)
36 self.assertEqual(expected_fault.faultString, fault.faultString)
37+ return fault
38
39 def test_resultDict(self):
40 # A given lp url path maps to a single branch available from a number
41@@ -121,8 +122,9 @@
42 # Resolving lp:///project_group_name' should explain that project
43 # groups don't have default branches.
44 project_group = self.factory.makeProject()
45- self.assertFault(
46+ fault = self.assertFault(
47 project_group.name, faults.CannotHaveLinkedBranch(project_group))
48+ self.assertIn('project group', fault.faultString)
49
50 def test_distro_name(self):
51 # Resolving lp:///distro_name' should explain that distributions don't