Merge lp:~stevenk/launchpad/archive-picker-value into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Steve Kowalik
Approved revision: no longer in the source branch.
Merged at revision: 13333
Proposed branch: lp:~stevenk/launchpad/archive-picker-value
Merge into: lp:launchpad
Diff against target: 117 lines (+24/-7)
6 files modified
lib/lp/app/browser/configure.zcml (+4/-0)
lib/lp/app/browser/vocabulary.py (+13/-0)
lib/lp/code/browser/tests/test_sourcepackagerecipe.py (+1/-1)
lib/lp/soyuz/browser/archive.py (+1/-1)
lib/lp/soyuz/browser/tests/archive-views.txt (+3/-3)
lib/lp/soyuz/stories/ppa/xx-copy-packages.txt (+2/-2)
To merge this branch: bzr merge lp:~stevenk/launchpad/archive-picker-value
Reviewer Review Type Date Requested Status
Benji York (community) code Approve
Review via email: mp+66318@code.launchpad.net

Commit message

[r=benji][bug=719795] Move the owner/name text for the daily build archive picker to the second line.

Description of the change

Change the picker used by the daily build archive field to move the text in brackets to the second line.

This is not tested at all, but it seems that none of the PickerEntry infrastructure is tested at all.

To post a comment you must log in.
Revision history for this message
Benji York (benji) wrote :

Looks good.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/app/browser/configure.zcml'
2--- lib/lp/app/browser/configure.zcml 2011-06-10 18:34:34 +0000
3+++ lib/lp/app/browser/configure.zcml 2011-06-29 21:46:57 +0000
4@@ -414,6 +414,10 @@
5 factory="lp.app.browser.vocabulary.SourcePackageNamePickerEntryAdapter"
6 />
7
8+ <adapter
9+ factory="lp.app.browser.vocabulary.ArchivePickerEntryAdapter"
10+ />
11+
12 <!-- TALES namespaces. -->
13
14 <!-- TALES lp: namespace (should be deprecated) -->
15
16=== modified file 'lib/lp/app/browser/vocabulary.py'
17--- lib/lp/app/browser/vocabulary.py 2011-06-03 12:26:05 +0000
18+++ lib/lp/app/browser/vocabulary.py 2011-06-29 21:46:57 +0000
19@@ -42,6 +42,7 @@
20 from lp.registry.model.pillaraffiliation import IHasAffiliation
21 from lp.registry.model.sourcepackagename import getSourcePackageDescriptions
22 from lp.services.features import getFeatureFlag
23+from lp.soyuz.interfaces.archive import IArchive
24
25 # XXX: EdwinGrubbs 2009-07-27 bug=405476
26 # This limits the output to one line of text, since the sprite class
27@@ -186,6 +187,18 @@
28 return extra
29
30
31+@adapter(IArchive)
32+class ArchivePickerEntryAdapter(DefaultPickerEntryAdapter):
33+ """Adapts IArchive to IPickerEntry."""
34+
35+ def getPickerEntry(self, associated_object, **kwarg):
36+ archive = self.context
37+ extra = super(ArchivePickerEntryAdapter, self).getPickerEntry(
38+ associated_object)
39+ extra.description = '%s/%s' % (archive.owner.name, archive.name)
40+ return extra
41+
42+
43 class HugeVocabularyJSONView:
44 """Export vocabularies as JSON.
45
46
47=== modified file 'lib/lp/code/browser/tests/test_sourcepackagerecipe.py'
48--- lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2011-05-27 21:12:25 +0000
49+++ lib/lp/code/browser/tests/test_sourcepackagerecipe.py 2011-06-29 21:46:57 +0000
50@@ -1348,7 +1348,7 @@
51 cake_recipe
52 Request builds for cake_recipe
53 Archive:
54- Secret PPA (chef/ppa)
55+ Secret PPA
56 Distribution series:
57 Secret Squirrel
58 Hoary
59
60=== modified file 'lib/lp/soyuz/browser/archive.py'
61--- lib/lp/soyuz/browser/archive.py 2011-06-29 14:43:34 +0000
62+++ lib/lp/soyuz/browser/archive.py 2011-06-29 21:46:57 +0000
63@@ -1387,7 +1387,7 @@
64 terms = []
65 for archive in archives:
66 token = '%s/%s' % (archive.owner.name, archive.name)
67- label = '%s (%s)' % (archive.displayname, token)
68+ label = archive.displayname
69 terms.append(SimpleTerm(archive, token, label))
70 return SimpleVocabulary(terms)
71
72
73=== modified file 'lib/lp/soyuz/browser/tests/archive-views.txt'
74--- lib/lp/soyuz/browser/tests/archive-views.txt 2011-06-28 14:43:13 +0000
75+++ lib/lp/soyuz/browser/tests/archive-views.txt 2011-06-29 21:46:57 +0000
76@@ -1252,7 +1252,7 @@
77
78 >>> for item in archive_widget.vocabulary:
79 ... print item.title
80- PPA for Ubuntu Team (ubuntu-team/ppa)
81+ PPA for Ubuntu Team
82
83 >>> print archive_widget.getInputValue() == cprov.archive
84 True
85@@ -1302,8 +1302,8 @@
86
87 >>> for item in archive_widget.vocabulary:
88 ... print item.title
89- PPA for Celso Providelo (cprov/ppa)
90- PPA for No Privileges Person (no-priv/ppa)
91+ PPA for Celso Providelo
92+ PPA for No Privileges Person
93
94 >>> print archive_widget.getInputValue()
95 Traceback (most recent call last):
96
97=== modified file 'lib/lp/soyuz/stories/ppa/xx-copy-packages.txt'
98--- lib/lp/soyuz/stories/ppa/xx-copy-packages.txt 2011-01-29 00:19:18 +0000
99+++ lib/lp/soyuz/stories/ppa/xx-copy-packages.txt 2011-06-29 21:46:57 +0000
100@@ -202,7 +202,7 @@
101
102 >>> print jblack_browser.getControl(
103 ... 'Destination PPA').displayOptions
104- ['PPA for James Blackwell (jblack/ppa)']
105+ ['PPA for James Blackwell']
106
107 >>> print jblack_browser.getControl(
108 ... 'Destination PPA').value
109@@ -699,7 +699,7 @@
110
111 >>> print jblack_browser.getControl(
112 ... 'Destination PPA').displayOptions
113- ['PPA for James Blackwell (jblack/ppa)', 'PPA for James Blackwell Friends (jblack-friends/ppa)']
114+ ['PPA for James Blackwell', 'PPA for James Blackwell Friends']
115
116 James wants to populate the PPA for James Blackwell Friends, he
117 selects that.