Merge lp:~leonardr/launchpad/reword-desktop-integration into lp:launchpad/db-devel

Proposed by Leonard Richardson
Status: Superseded
Proposed branch: lp:~leonardr/launchpad/reword-desktop-integration
Merge into: lp:launchpad/db-devel
Diff against target: 309 lines (+83/-62)
6 files modified
lib/canonical/launchpad/database/oauth.py (+23/-11)
lib/canonical/launchpad/pagetests/oauth/authorize-token.txt (+8/-10)
lib/canonical/launchpad/pagetests/oauth/managing-tokens.txt (+47/-32)
lib/canonical/launchpad/templates/oauth-authorize.pt (+1/-1)
lib/canonical/launchpad/templates/token-authorized.pt (+3/-7)
lib/canonical/launchpad/webapp/interfaces.py (+1/-1)
To merge this branch: bzr merge lp:~leonardr/launchpad/reword-desktop-integration
Reviewer Review Type Date Requested Status
Māris Fogels (community) Approve
Review via email: mp+39892@code.launchpad.net

This proposal has been superseded by a proposal from 2010-11-03.

Description of the change

This branch makes two changes to improve the user experience for desktop-wide integration.

1. Instead of referring to the client computer as "The [system type]" it now refers to the client as "The [system type] computer". The original plan was that the client would know whether it was running on a desktop, a server or a phone, and send the appropriate information in the system type, eg. "Ubuntu desktop", "Android phone". But this turns out not to be possible right now. The best we can do ATM is determine the OS, eg. "Ubuntu" or "Darwin". This branch changes the templates so that you see "The Ubuntu computer" instead of "The Ubuntu".

2. On your list of authorized clients, a desktop integration token showed up as "Authorized to desktop integration", which doesn't make grammatical sense. I changed things so that it shows up as "Authorized to integrate an entire computer". I cleaned up the test for this a little bit, replacing some custom object-creation code with corresponding factory code, but I didn't go all the way because I just want to get this out the door and be done with it.

I don't know whether this needs a UI review--I'm changing code and templates, but the effect is just to correct obvious grammatical problems.

To post a comment you must log in.
Revision history for this message
Māris Fogels (mars) wrote :

Hi Leonard,

This looks good, r=mars.

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/database/oauth.py'
2--- lib/canonical/launchpad/database/oauth.py 2010-10-18 12:47:22 +0000
3+++ lib/canonical/launchpad/database/oauth.py 2010-11-02 20:26:15 +0000
4@@ -105,17 +105,29 @@
5 secret = StringCol(notNull=False, default='')
6
7 # This regular expression singles out a consumer key that
8- # represents any and all apps running on a specific computer
9- # (usually a desktop). For instance:
10- #
11- # System-wide: Ubuntu desktop (hostname1)
12- # - An Ubuntu desktop called "hostname1"
13- # System-wide: Windows desktop (Computer Name)
14- # - A Windows desktop called "Computer Name"
15- # System-wide: Mac OS desktop (hostname2)
16- # - A Macintosh desktop called "hostname2"
17- # System-wide Android phone (Bob's Phone)
18- # - An Android phone called "Bob's Phone"
19+ # represents any and all apps running on a specific computer. The
20+ # regular expression identifies the system type (eg. the OS) and
21+ # the name of the computer (eg. the hostname).
22+ #
23+ # A client can send whatever string they want, as long as it
24+ # matches the regular expression, but here are some values we've
25+ # seen from the lazr.restfulclient code for generating this
26+ # string.
27+ #
28+ # System-wide: Ubuntu (hostname)
29+ # - An Ubuntu computer called "hostname"
30+ # System-wide: debian (hostname)
31+ # - A Debian computer called "hostname"
32+ # (A Nokia N900 phone also sends this string.)
33+ # System-wide: Windows (hostname)
34+ # - A Windows computer called "hostname"
35+ # System-wide: Microsoft (hostname)
36+ # - A Windows computer called "hostname", running an old version
37+ # of Python
38+ # System-wide: Darwin (hostname)
39+ # - A Mac OS X computer called "hostname"
40+ # (Presumably an iPhone will also send this string,
41+ # but we're not sure.)
42 integrated_desktop_re = re.compile("^System-wide: (.*) \(([^)]*)\)$")
43
44 def _integrated_desktop_match_group(self, position):
45
46=== modified file 'lib/canonical/launchpad/pagetests/oauth/authorize-token.txt'
47--- lib/canonical/launchpad/pagetests/oauth/authorize-token.txt 2010-10-21 10:30:20 +0000
48+++ lib/canonical/launchpad/pagetests/oauth/authorize-token.txt 2010-11-02 20:26:15 +0000
49@@ -279,7 +279,7 @@
50
51 >>> login('foo.bar@canonical.com')
52 >>> consumer = factory.makeOAuthConsumer(
53- ... "System-wide: Ubuntu desktop (mycomputer)")
54+ ... "System-wide: Ubuntu (mycomputer)")
55 >>> logout()
56
57 >>> token = request_token_for(consumer)
58@@ -293,7 +293,7 @@
59 ... authorize_token_main_content(
60 ... 'allow_permission=DESKTOP_INTEGRATION'))
61 Confirm Computer Access
62- The Ubuntu desktop called mycomputer wants access to your
63+ The Ubuntu computer called mycomputer wants access to your
64 Launchpad account. If you allow this, every application running on
65 mycomputer will have read-write access to your Launchpad account,
66 including to your private data.
67@@ -394,7 +394,7 @@
68 >>> token = integrate_desktop("Until I Disable It")
69 >>> print extract_text(find_tag_by_id(browser.contents, 'maincontent'))
70 Almost finished ...
71- The Ubuntu desktop called mycomputer now has access to your
72+ The Ubuntu computer called mycomputer now has access to your
73 Launchpad account. Within a few seconds, you should be able to
74 start using its Launchpad integration features.
75
76@@ -416,13 +416,12 @@
77
78 >>> print extract_text(find_tag_by_id(browser.contents, 'maincontent'))
79 Almost finished ...
80- The Ubuntu desktop called mycomputer now has access to your
81+ The Ubuntu computer called mycomputer now has access to your
82 Launchpad account. Within a few seconds, you should be able to
83 start using its Launchpad integration features.
84 The integration you just authorized will expire in 59 minutes. At
85- that time, you'll have to re-authorize the Ubuntu desktop called
86- mycomputer, if you want to keep using its Launchpad integration
87- features.
88+ that time, you'll have to re-authorize mycomputer, if you want to
89+ keep using its Launchpad integration features.
90
91 >>> print token.is_reviewed
92 True
93@@ -480,9 +479,8 @@
94
95 >>> print extract_text(find_tag_by_id(browser.contents, 'maincontent'))
96 You decided against desktop integration
97- You decided not to give the Ubuntu desktop called mycomputer
98- access to your Launchpad account. You can always change your mind
99- later.
100+ You decided not to give mycomputer access to your Launchpad
101+ account. You can always change your mind later.
102
103 >>> print token.is_reviewed
104 True
105
106=== modified file 'lib/canonical/launchpad/pagetests/oauth/managing-tokens.txt'
107--- lib/canonical/launchpad/pagetests/oauth/managing-tokens.txt 2010-10-18 22:24:59 +0000
108+++ lib/canonical/launchpad/pagetests/oauth/managing-tokens.txt 2010-11-02 20:26:15 +0000
109@@ -3,17 +3,24 @@
110 All access tokens and request tokens for a given user can be seen
111 and/or revoked from that user's +oauth-tokens page.
112
113- # Create a request token, but don't convert it to an access token.
114 >>> from zope.component import getUtility
115- >>> from canonical.launchpad.interfaces.oauth import IOAuthConsumerSet
116+ >>> from lp.registry.interfaces.person import IPersonSet
117 >>> from canonical.launchpad.webapp.interfaces import OAuthPermission
118- >>> from lp.registry.interfaces.person import IPersonSet
119- >>> from lp.registry.interfaces.product import IProductSet
120+
121+ # Create a desktop integration token.
122 >>> login('salgado@ubuntu.com')
123- >>> token = getUtility(IOAuthConsumerSet).getByKey(
124- ... 'foobar123451432').newRequestToken()
125- >>> token.review(getUtility(IPersonSet).getByName('salgado'),
126- ... OAuthPermission.READ_PRIVATE)
127+ >>> consumer = factory.makeOAuthConsumer(
128+ ... "System-wide: Ubuntu (mycomputer)")
129+ >>> salgado = getUtility(IPersonSet).getByName('salgado')
130+ >>> desktop_token = factory.makeOAuthAccessToken(
131+ ... consumer, salgado, OAuthPermission.DESKTOP_INTEGRATION)
132+
133+ # Create a request token, authorize it for READ_PRIVATE access,
134+ # but don't exchange it for an access token.
135+ >>> consumer = factory.makeOAuthConsumer(
136+ ... "Example consumer for READ_PRIVATE")
137+ >>> request_token = factory.makeOAuthRequestToken()
138+ >>> request_token.review(salgado, OAuthPermission.READ_PRIVATE)
139 >>> logout()
140
141 # View the tokens.
142@@ -26,17 +33,16 @@
143 Authorized applications
144 ...
145 Claimed tokens:
146- Application name:
147- foobar123451432
148- Authorized...to read non-private data
149- Application name:
150- launchpad-library
151- Authorized...to change anything
152+ Application name: System-wide: Ubuntu (mycomputer)
153+ Authorized...to integrate an entire system
154+ Application name: foobar123451432
155+ Authorized...to read non-private data
156+ Application name: launchpad-library
157+ Authorized...to change anything
158 Unclaimed tokens:
159- Application name:
160- foobar123451432
161- Authorized...to read anything
162- Must be claimed before...
163+ Application name: oauthconsumerkey...
164+ Authorized...to read anything
165+ Must be claimed before
166
167 For each token we have a separate <form> with the token and consumer
168 keys stored in hidden <input>s as well as the button to revoke the
169@@ -45,7 +51,7 @@
170 >>> li = find_tag_by_id(main_content, 'tokens').find('li')
171 >>> for input in li.find('form').findAll('input'):
172 ... print input['name'], input['value']
173- consumer_key foobar123451432
174+ consumer_key System-wide: Ubuntu (mycomputer)
175 token_key ...
176 token_type access_token
177 revoke Revoke Authorization
178@@ -53,15 +59,23 @@
179 >>> li2 = li.findNextSibling('li')
180 >>> for input in li2.find('form').findAll('input'):
181 ... print input['name'], input['value']
182- consumer_key launchpad-library
183- token_key ...
184+ consumer_key foobar123451432
185+ token_key salgado-read-nonprivate
186 token_type access_token
187 revoke Revoke Authorization
188
189 >>> li3 = li2.findNext('li')
190 >>> for input in li3.find('form').findAll('input'):
191 ... print input['name'], input['value']
192- consumer_key foobar123451432
193+ consumer_key launchpad-library
194+ token_key salgado-change-anything
195+ token_type access_token
196+ revoke Revoke Authorization
197+
198+ >>> li4 = li3.findNext('li')
199+ >>> for input in li4.find('form').findAll('input'):
200+ ... print input['name'], input['value']
201+ consumer_key oauthconsumerkey...
202 token_key ...
203 token_type request_token
204 revoke Revoke Authorization
205@@ -70,7 +84,7 @@
206 Launchpad on that user's behalf anymore, nor will that application be
207 shown as one of the authorized ones.
208
209- >>> my_browser.getControl('Revoke Authorization', index=1).click()
210+ >>> my_browser.getControl('Revoke Authorization', index=2).click()
211 >>> print my_browser.title
212 Authorized applications...
213 >>> for message in get_feedback_messages(my_browser.contents):
214@@ -82,24 +96,25 @@
215 Authorized applications
216 ...
217 Claimed tokens:
218- Application name:
219- foobar123451432
220- Authorized...to read non-private data
221+ Application name: System-wide: Ubuntu (mycomputer)
222+ Authorized...to integrate an entire system
223+ Application name: foobar123451432
224+ Authorized...to read non-private data
225 Unclaimed tokens:
226- Application name:
227- foobar123451432
228- Authorized...to read anything
229- Must be claimed before...
230+ Application name: oauthconsumerkey...
231+ Authorized...to read anything
232+ Must be claimed before
233
234 Some tokens grant access only to a certain context in Launchpad. If
235 that's the case, the description of the authorization granted will
236 include that.
237
238+ >>> from lp.registry.interfaces.product import IProductSet
239+ >>> from canonical.launchpad.interfaces.oauth import IOAuthConsumerSet
240 >>> login('salgado@ubuntu.com')
241 >>> token = getUtility(IOAuthConsumerSet).getByKey(
242 ... 'launchpad-library').newRequestToken()
243- >>> token.review(getUtility(IPersonSet).getByName('salgado'),
244- ... OAuthPermission.WRITE_PUBLIC,
245+ >>> token.review(salgado, OAuthPermission.WRITE_PUBLIC,
246 ... context=getUtility(IProductSet)['firefox'])
247 >>> access_token = token.createAccessToken()
248 >>> logout()
249
250=== modified file 'lib/canonical/launchpad/templates/oauth-authorize.pt'
251--- lib/canonical/launchpad/templates/oauth-authorize.pt 2010-10-20 20:31:30 +0000
252+++ lib/canonical/launchpad/templates/oauth-authorize.pt 2010-11-02 20:26:15 +0000
253@@ -27,7 +27,7 @@
254 <p>The
255 <tal:desktop replace="structure
256 token/consumer/integrated_desktop_type" />
257- called
258+ computer called
259 <strong tal:content="token/consumer/integrated_desktop_name">hostname</strong>
260 wants access to your Launchpad account. If you allow this,
261 every application running
262
263=== modified file 'lib/canonical/launchpad/templates/token-authorized.pt'
264--- lib/canonical/launchpad/templates/token-authorized.pt 2010-10-19 12:27:12 +0000
265+++ lib/canonical/launchpad/templates/token-authorized.pt 2010-11-02 20:26:15 +0000
266@@ -15,9 +15,7 @@
267 <h1>You decided against desktop integration</h1>
268
269 <p>
270- You decided not to give the
271- <tal:desktop replace="structure view/token/consumer/integrated_desktop_type" />
272- called
273+ You decided not to give
274 <strong tal:content="view/token/consumer/integrated_desktop_name">hostname</strong>
275 access to your Launchpad account. You can always change your
276 mind later.
277@@ -29,7 +27,7 @@
278
279 <p>The
280 <tal:desktop replace="structure view/token/consumer/integrated_desktop_type" />
281- called
282+ computer called
283 <strong tal:content="view/token/consumer/integrated_desktop_name">hostname</strong>
284 now has access to your Launchpad account. Within a few
285 seconds, you should be able to start using its Launchpad
286@@ -39,9 +37,7 @@
287 The integration you just authorized will expire
288 <tal:date
289 replace="structure view/token/date_expires/fmt:approximatedate" />.
290- At that time, you'll have to re-authorize the
291- <tal:desktop replace="structure view/token/consumer/integrated_desktop_type" />
292- called
293+ At that time, you'll have to re-authorize
294 <strong tal:content="view/token/consumer/integrated_desktop_name">hostname</strong>,
295 if you want to keep using its Launchpad integration features.
296
297
298=== modified file 'lib/canonical/launchpad/webapp/interfaces.py'
299--- lib/canonical/launchpad/webapp/interfaces.py 2010-10-14 16:54:34 +0000
300+++ lib/canonical/launchpad/webapp/interfaces.py 2010-11-02 20:26:15 +0000
301@@ -532,7 +532,7 @@
302 """)
303
304 DESKTOP_INTEGRATION = DBItem(60, """
305- Desktop Integration
306+ Integrate an entire system
307
308 Every application running on your desktop will have read-write
309 access to your Launchpad account, including to your private

Subscribers

People subscribed via source and target branches

to status/vote changes: