← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~leonardr/launchpad/reword-desktop-integration into lp:launchpad

 

Leonard Richardson has proposed merging lp:~leonardr/launchpad/reword-desktop-integration into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)


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.
-- 
https://code.launchpad.net/~leonardr/launchpad/reword-desktop-integration/+merge/39892
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~leonardr/launchpad/reword-desktop-integration into lp:launchpad.
=== modified file 'lib/canonical/launchpad/database/oauth.py'
--- lib/canonical/launchpad/database/oauth.py	2010-10-18 12:47:22 +0000
+++ lib/canonical/launchpad/database/oauth.py	2010-11-02 20:26:15 +0000
@@ -105,17 +105,29 @@
     secret = StringCol(notNull=False, default='')
 
     # This regular expression singles out a consumer key that
-    # represents any and all apps running on a specific computer
-    # (usually a desktop). For instance:
-    #
-    # System-wide: Ubuntu desktop (hostname1)
-    #  - An Ubuntu desktop called "hostname1"
-    # System-wide: Windows desktop (Computer Name)
-    #  - A Windows desktop called "Computer Name"
-    # System-wide: Mac OS desktop (hostname2)
-    #  - A Macintosh desktop called "hostname2"
-    # System-wide Android phone (Bob's Phone)
-    #  - An Android phone called "Bob's Phone"
+    # represents any and all apps running on a specific computer. The
+    # regular expression identifies the system type (eg. the OS) and
+    # the name of the computer (eg. the hostname).
+    #
+    # A client can send whatever string they want, as long as it
+    # matches the regular expression, but here are some values we've
+    # seen from the lazr.restfulclient code for generating this
+    # string.
+    #
+    # System-wide: Ubuntu (hostname)
+    #  - An Ubuntu computer called "hostname"
+    # System-wide: debian (hostname)
+    #  - A Debian computer called "hostname"
+    #    (A Nokia N900 phone also sends this string.)
+    # System-wide: Windows (hostname)
+    #  - A Windows computer called "hostname"
+    # System-wide: Microsoft (hostname)
+    #  - A Windows computer called "hostname", running an old version
+    #    of Python
+    # System-wide: Darwin (hostname)
+    #  - A Mac OS X computer called "hostname"
+    #    (Presumably an iPhone will also send this string,
+    #     but we're not sure.)
     integrated_desktop_re = re.compile("^System-wide: (.*) \(([^)]*)\)$")
 
     def _integrated_desktop_match_group(self, position):

=== modified file 'lib/canonical/launchpad/pagetests/oauth/authorize-token.txt'
--- lib/canonical/launchpad/pagetests/oauth/authorize-token.txt	2010-10-21 10:30:20 +0000
+++ lib/canonical/launchpad/pagetests/oauth/authorize-token.txt	2010-11-02 20:26:15 +0000
@@ -279,7 +279,7 @@
 
     >>> login('foo.bar@xxxxxxxxxxxxx')
     >>> consumer = factory.makeOAuthConsumer(
-    ...     "System-wide: Ubuntu desktop (mycomputer)")
+    ...     "System-wide: Ubuntu (mycomputer)")
     >>> logout()
 
     >>> token = request_token_for(consumer)
@@ -293,7 +293,7 @@
     ...     authorize_token_main_content(
     ...         'allow_permission=DESKTOP_INTEGRATION'))
     Confirm Computer Access
-    The Ubuntu desktop called mycomputer wants access to your
+    The Ubuntu computer called mycomputer wants access to your
     Launchpad account. If you allow this, every application running on
     mycomputer will have read-write access to your Launchpad account,
     including to your private data.
@@ -394,7 +394,7 @@
     >>> token = integrate_desktop("Until I Disable It")
     >>> print extract_text(find_tag_by_id(browser.contents, 'maincontent'))
     Almost finished ...
-    The Ubuntu desktop called mycomputer now has access to your
+    The Ubuntu computer called mycomputer now has access to your
     Launchpad account. Within a few seconds, you should be able to
     start using its Launchpad integration features.
 
@@ -416,13 +416,12 @@
 
     >>> print extract_text(find_tag_by_id(browser.contents, 'maincontent'))
     Almost finished ...
-    The Ubuntu desktop called mycomputer now has access to your
+    The Ubuntu computer called mycomputer now has access to your
     Launchpad account. Within a few seconds, you should be able to
     start using its Launchpad integration features.
     The integration you just authorized will expire in 59 minutes. At
-    that time, you'll have to re-authorize the Ubuntu desktop called
-    mycomputer, if you want to keep using its Launchpad integration
-    features.
+    that time, you'll have to re-authorize mycomputer, if you want to
+    keep using its Launchpad integration features.
 
     >>> print token.is_reviewed
     True
@@ -480,9 +479,8 @@
 
     >>> print extract_text(find_tag_by_id(browser.contents, 'maincontent'))
     You decided against desktop integration
-    You decided not to give the Ubuntu desktop called mycomputer
-    access to your Launchpad account. You can always change your mind
-    later.
+    You decided not to give mycomputer access to your Launchpad
+    account. You can always change your mind later.
 
     >>> print token.is_reviewed
     True

=== modified file 'lib/canonical/launchpad/pagetests/oauth/managing-tokens.txt'
--- lib/canonical/launchpad/pagetests/oauth/managing-tokens.txt	2010-10-18 22:24:59 +0000
+++ lib/canonical/launchpad/pagetests/oauth/managing-tokens.txt	2010-11-02 20:26:15 +0000
@@ -3,17 +3,24 @@
 All access tokens and request tokens for a given user can be seen
 and/or revoked from that user's +oauth-tokens page.
 
-    # Create a request token, but don't convert it to an access token.
     >>> from zope.component import getUtility
-    >>> from canonical.launchpad.interfaces.oauth import IOAuthConsumerSet
+    >>> from lp.registry.interfaces.person import IPersonSet
     >>> from canonical.launchpad.webapp.interfaces import OAuthPermission
-    >>> from lp.registry.interfaces.person import IPersonSet
-    >>> from lp.registry.interfaces.product import IProductSet
+
+    # Create a desktop integration token.
     >>> login('salgado@xxxxxxxxxx')
-    >>> token = getUtility(IOAuthConsumerSet).getByKey(
-    ...     'foobar123451432').newRequestToken()
-    >>> token.review(getUtility(IPersonSet).getByName('salgado'),
-    ...              OAuthPermission.READ_PRIVATE)
+    >>> consumer = factory.makeOAuthConsumer(
+    ...     "System-wide: Ubuntu (mycomputer)")
+    >>> salgado = getUtility(IPersonSet).getByName('salgado')
+    >>> desktop_token = factory.makeOAuthAccessToken(
+    ...     consumer, salgado, OAuthPermission.DESKTOP_INTEGRATION)
+
+    # Create a request token, authorize it for READ_PRIVATE access,
+    # but don't exchange it for an access token.
+    >>> consumer = factory.makeOAuthConsumer(
+    ...     "Example consumer for READ_PRIVATE")
+    >>> request_token = factory.makeOAuthRequestToken()
+    >>> request_token.review(salgado, OAuthPermission.READ_PRIVATE)
     >>> logout()
 
     # View the tokens.
@@ -26,17 +33,16 @@
     Authorized applications
     ...
     Claimed tokens:
-    Application name:
-        foobar123451432
-        Authorized...to read non-private data
-    Application name:
-        launchpad-library
-        Authorized...to change anything
+    Application name: System-wide: Ubuntu (mycomputer)
+    Authorized...to integrate an entire system
+    Application name: foobar123451432
+    Authorized...to read non-private data
+    Application name: launchpad-library
+    Authorized...to change anything
     Unclaimed tokens:
-    Application name:
-        foobar123451432
-        Authorized...to read anything
-        Must be claimed before...
+    Application name: oauthconsumerkey...
+    Authorized...to read anything
+    Must be claimed before
 
 For each token we have a separate <form> with the token and consumer
 keys stored in hidden <input>s as well as the button to revoke the
@@ -45,7 +51,7 @@
     >>> li = find_tag_by_id(main_content, 'tokens').find('li')
     >>> for input in li.find('form').findAll('input'):
     ...     print input['name'], input['value']
-    consumer_key foobar123451432
+    consumer_key System-wide: Ubuntu (mycomputer)
     token_key ...
     token_type access_token
     revoke Revoke Authorization
@@ -53,15 +59,23 @@
     >>> li2 = li.findNextSibling('li')
     >>> for input in li2.find('form').findAll('input'):
     ...     print input['name'], input['value']
-    consumer_key launchpad-library
-    token_key ...
+    consumer_key foobar123451432
+    token_key salgado-read-nonprivate
     token_type access_token
     revoke Revoke Authorization
 
     >>> li3 = li2.findNext('li')
     >>> for input in li3.find('form').findAll('input'):
     ...     print input['name'], input['value']
-    consumer_key foobar123451432
+    consumer_key launchpad-library
+    token_key salgado-change-anything
+    token_type access_token
+    revoke Revoke Authorization
+
+    >>> li4 = li3.findNext('li')
+    >>> for input in li4.find('form').findAll('input'):
+    ...     print input['name'], input['value']
+    consumer_key oauthconsumerkey...
     token_key ...
     token_type request_token
     revoke Revoke Authorization
@@ -70,7 +84,7 @@
 Launchpad on that user's behalf anymore, nor will that application be
 shown as one of the authorized ones.
 
-    >>> my_browser.getControl('Revoke Authorization', index=1).click()
+    >>> my_browser.getControl('Revoke Authorization', index=2).click()
     >>> print my_browser.title
     Authorized applications...
     >>> for message in get_feedback_messages(my_browser.contents):
@@ -82,24 +96,25 @@
     Authorized applications
     ...
     Claimed tokens:
-    Application name:
-        foobar123451432
-        Authorized...to read non-private data
+    Application name: System-wide: Ubuntu (mycomputer)
+    Authorized...to integrate an entire system
+    Application name: foobar123451432
+    Authorized...to read non-private data
     Unclaimed tokens:
-    Application name:
-        foobar123451432
-        Authorized...to read anything
-        Must be claimed before...
+    Application name: oauthconsumerkey...
+    Authorized...to read anything
+    Must be claimed before
 
 Some tokens grant access only to a certain context in Launchpad.  If
 that's the case, the description of the authorization granted will
 include that.
 
+    >>> from lp.registry.interfaces.product import IProductSet
+    >>> from canonical.launchpad.interfaces.oauth import IOAuthConsumerSet
     >>> login('salgado@xxxxxxxxxx')
     >>> token = getUtility(IOAuthConsumerSet).getByKey(
     ...     'launchpad-library').newRequestToken()
-    >>> token.review(getUtility(IPersonSet).getByName('salgado'),
-    ...              OAuthPermission.WRITE_PUBLIC,
+    >>> token.review(salgado, OAuthPermission.WRITE_PUBLIC,
     ...              context=getUtility(IProductSet)['firefox'])
     >>> access_token = token.createAccessToken()
     >>> logout()

=== modified file 'lib/canonical/launchpad/templates/oauth-authorize.pt'
--- lib/canonical/launchpad/templates/oauth-authorize.pt	2010-10-20 20:31:30 +0000
+++ lib/canonical/launchpad/templates/oauth-authorize.pt	2010-11-02 20:26:15 +0000
@@ -27,7 +27,7 @@
              <p>The
                <tal:desktop replace="structure
                token/consumer/integrated_desktop_type" />
-             called
+             computer called
              <strong tal:content="token/consumer/integrated_desktop_name">hostname</strong>
              wants access to your Launchpad account. If you allow this,
              every application running

=== modified file 'lib/canonical/launchpad/templates/token-authorized.pt'
--- lib/canonical/launchpad/templates/token-authorized.pt	2010-10-19 12:27:12 +0000
+++ lib/canonical/launchpad/templates/token-authorized.pt	2010-11-02 20:26:15 +0000
@@ -15,9 +15,7 @@
         <h1>You decided against desktop integration</h1>
 
         <p>
-          You decided not to give the
-          <tal:desktop replace="structure view/token/consumer/integrated_desktop_type" />
-          called
+          You decided not to give
           <strong tal:content="view/token/consumer/integrated_desktop_name">hostname</strong>
           access to your Launchpad account. You can always change your
           mind later.
@@ -29,7 +27,7 @@
 
         <p>The
           <tal:desktop replace="structure view/token/consumer/integrated_desktop_type" />
-          called
+          computer called
           <strong tal:content="view/token/consumer/integrated_desktop_name">hostname</strong>
           now has access to your Launchpad account. Within a few
           seconds, you should be able to start using its Launchpad
@@ -39,9 +37,7 @@
           The integration you just authorized will expire
           <tal:date
            replace="structure view/token/date_expires/fmt:approximatedate" />.
-          At that time, you'll have to re-authorize the
-          <tal:desktop replace="structure view/token/consumer/integrated_desktop_type" />
-          called
+          At that time, you'll have to re-authorize
           <strong tal:content="view/token/consumer/integrated_desktop_name">hostname</strong>,
           if you want to keep using its Launchpad integration features.
 

=== modified file 'lib/canonical/launchpad/webapp/interfaces.py'
--- lib/canonical/launchpad/webapp/interfaces.py	2010-10-14 16:54:34 +0000
+++ lib/canonical/launchpad/webapp/interfaces.py	2010-11-02 20:26:15 +0000
@@ -532,7 +532,7 @@
         """)
 
     DESKTOP_INTEGRATION = DBItem(60, """
-        Desktop Integration
+        Integrate an entire system
 
         Every application running on your desktop will have read-write
         access to your Launchpad account, including to your private