Merge lp:~bac/launchpad/bug-421976-pgp-ssh-wiki into lp:launchpad

Proposed by Brad Crittenden
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bac/launchpad/bug-421976-pgp-ssh-wiki
Merge into: lp:launchpad
Diff against target: None lines
To merge this branch: bzr merge lp:~bac/launchpad/bug-421976-pgp-ssh-wiki
Reviewer Review Type Date Requested Status
Curtis Hovey (community) code, ui Approve
Canonical Launchpad Engineering Pending
Review via email: mp+11449@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

= Summary =

Bug 421976 addresses the need to update three page templates:
    person-editpgpkeys.pt
    person-editsshkeys.pt
    person-editwikinames.pt

== Proposed fix ==

The changes made were mostly mechanical. Details are below in the QA section.

== Pre-implementation notes ==

N/A

== Tests ==

bin/test -vvm lp.registry -t gpg -t wiki -t ssh
== Demo and Q/A ==

Screenshots, old and new, are
at:http://people.canonical.com/~bac/bug-421976-pgp-ssh-wiki/

Login as Salgado for these demos.

Each of these page templates is a mush of hand-built forms rendered
using a LaunchpadView. At some point these pages should be converted
to LaunchpadFormView but for expediency I am not now.

For all pages:
* added label and page_title to the views and removed from pagetitles.py.
* faked LaunchpadFormView by putting the view/label into an <h1> at
  the top of the page.
* Added a 'cancel_url' property and manually use it in the template.
  The cancel url is set to '+edit' for all, though perhaps just
  returning to the user's page would be best. It depends on what the
  +edit page ends up looking.
* Several of these pages use the Launchpad help system. Is the pop-up
  help system being removed? The conversion primer indicates that is
  the case that decision needs to be vetted.

* https://launchpad.dev/~salgado/+editwikinames
  * No changes beyond the above.

* https://launchpad.dev/~salgado/+editsshkeys
  * Discovered the textarea has always been absurdly small due to
    using 'height' and 'width' rather than the correct 'rows' and
    'cols'. Now it renders as a usable size.
  * This form should use a file chooser that gets uploaded rather than
    a text widget that the user must paste into.

* https://launchpad.dev/~salgado/+editpgpkeys
  * No changes beyond the above.

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/canonical/launchpad/pagetitles.py
  lib/lp/registry/browser/person.py
  lib/lp/registry/stories/foaf/xx-add-sshkey.txt
  lib/lp/registry/stories/gpg-coc/01-claimgpg.txt
  lib/lp/registry/templates/person-editpgpkeys.pt
  lib/lp/registry/templates/person-editsshkeys.pt
  lib/lp/registry/templates/person-editwikinames.pt

== Pylint notices ==

lib/lp/registry/browser/person.py
    118: [F0401] Unable to import 'lazr.delegates' (No module named delegates)
    119: [F0401] Unable to import 'lazr.config' (No module named config)
    120: [F0401] Unable to import 'lazr.restful.interface' (No module named restful)

Revision history for this message
Curtis Hovey (sinzui) wrote :

This is great. Thanks Brad. I have one trivial request before you land this...

=== modified file 'lib/lp/registry/templates/person-editpgpkeys.pt'
--- lib/lp/registry/templates/person-editpgpkeys.pt 2009-07-17 17:59:07 +0000
+++ lib/lp/registry/templates/person-editpgpkeys.pt 2009-09-09 13:49:06 +0000

...

@@ -173,7 +170,7 @@
       <input type="hidden" name="action" value="claim_gpg" />
       <h2>Import an OpenPGP key</h2>

- <p>To start using an OpenPGP key with your Launchpad account, simply paste its fingerprint below. (<a href="/+help/import-pgp-key.html" target="help">How to get the fingerprint</a>)
+ <p>To start using an OpenPGP key with your Launchpad account, simply paste its fingerprint below. (<a href="/+help/import-pgp-key.html" target="help">How to get the fingerprint</a>)</p>

Can you wrap this? I had to pan for some time to see what changed.

...

review: Approve (code, ui)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/pagetitles.py'
2--- lib/canonical/launchpad/pagetitles.py 2009-09-09 09:24:47 +0000
3+++ lib/canonical/launchpad/pagetitles.py 2009-09-09 13:33:33 +0000
4@@ -712,12 +712,6 @@
5
6 person_editemails = ContextDisplayName(smartquote("%s's e-mail addresses"))
7
8-person_editpgpkeys = ContextDisplayName(smartquote("%s's OpenPGP keys"))
9-
10-person_editsshkeys = ContextDisplayName(smartquote("%s's SSH keys"))
11-
12-person_editwikinames = ContextDisplayName(smartquote("%s's wiki names"))
13-
14 # person_foaf is an rdf file
15
16 person_hwdb_submissions = ContextDisplayName(
17
18=== modified file 'lib/lp/registry/browser/person.py'
19--- lib/lp/registry/browser/person.py 2009-09-08 14:07:32 +0000
20+++ lib/lp/registry/browser/person.py 2009-09-09 13:33:33 +0000
21@@ -3182,6 +3182,17 @@
22
23
24 class PersonEditWikiNamesView(LaunchpadView):
25+
26+ @property
27+ def label(self):
28+ return smartquote("%s's wiki names" % self.context.displayname)
29+
30+ page_title = label
31+
32+ @property
33+ def cancel_url(self):
34+ return canonical_url(self.context, view_name="+edit")
35+
36 def _validateWikiURL(self, url):
37 """Validate the URL.
38
39@@ -3387,6 +3398,16 @@
40 else:
41 raise UnexpectedFormData("Unexpected action: %s" % action)
42
43+ @property
44+ def label(self):
45+ return "Change your SSH keys"
46+
47+ page_title = label
48+
49+ @property
50+ def cancel_url(self):
51+ return canonical_url(self.context, view_name="+edit")
52+
53 def add_ssh(self):
54 sshkey = self.request.form.get('sshkey')
55 try:
56@@ -3464,6 +3485,16 @@
57 error_message = None
58 info_message = None
59
60+ @property
61+ def cancel_url(self):
62+ return canonical_url(self.context, view_name="+edit")
63+
64+ @property
65+ def label(self):
66+ return "Change your OpenPGP keys"
67+
68+ page_title = label
69+
70 def keyserver_url(self):
71 assert self.fingerprint
72 return getUtility(
73
74=== modified file 'lib/lp/registry/stories/foaf/xx-add-sshkey.txt'
75--- lib/lp/registry/stories/foaf/xx-add-sshkey.txt 2009-06-11 18:09:32 +0000
76+++ lib/lp/registry/stories/foaf/xx-add-sshkey.txt 2009-09-09 16:16:18 +0000
77@@ -47,10 +47,7 @@
78
79 >>> browser.getLink('Add an SSH key').click()
80 >>> print browser.title
81- Guilherme Salgado's SSH keys
82- >>> print extract_text(
83- ... find_main_content(browser.contents).h2)
84- Add an SSH key
85+ Change your SSH keys
86
87 Any key must be of the form "keytype keytext comment", where keytype must be
88 either ssh-rsa or ssh-dss. If the key doesn't match the expected format, an
89@@ -127,13 +124,13 @@
90 Guilherme Salgado in Launchpad
91 >>> print extract_text(
92 ... find_tag_by_id(browser.contents, 'sshkeys'))
93- SSH Keys:
94+ SSH Keys:
95 salgado@canario
96 Update SSH keys
97 salgado@canario
98 >>> browser.getLink('Update SSH keys').click()
99 >>> print browser.title
100- Guilherme Salgado's SSH keys
101+ Change your SSH keys
102
103 >>> browser.getControl('Remove', index=0).click()
104 >>> soup = find_main_content(browser.contents)
105
106=== modified file 'lib/lp/registry/stories/gpg-coc/01-claimgpg.txt'
107--- lib/lp/registry/stories/gpg-coc/01-claimgpg.txt 2009-07-23 13:44:13 +0000
108+++ lib/lp/registry/stories/gpg-coc/01-claimgpg.txt 2009-09-09 16:16:18 +0000
109@@ -22,8 +22,8 @@
110 >>> browser = setupBrowser(auth='Basic test@canonical.com:test')
111 >>> browser.open("http://launchpad.dev/~name12/+edit")
112 >>> browser.getLink('OpenPGP Keys').click()
113- >>> browser.title
114- "Sample Person's OpenPGP keys"
115+ >>> print browser.title
116+ Change your OpenPGP keys
117 >>> browser.getControl(name='DEACTIVATE_GPGKEY')
118 Traceback (most recent call last):
119 ...
120
121=== modified file 'lib/lp/registry/templates/person-editpgpkeys.pt'
122--- lib/lp/registry/templates/person-editpgpkeys.pt 2009-07-17 17:59:07 +0000
123+++ lib/lp/registry/templates/person-editpgpkeys.pt 2009-09-09 13:49:06 +0000
124@@ -9,15 +9,12 @@
125 xmlns:tal="http://xml.zope.org/namespaces/tal"
126 xmlns:metal="http://xml.zope.org/namespaces/metal"
127 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
128- xml:lang="en"
129- lang="en"
130- dir="ltr"
131- metal:use-macro="view/macro:page/onecolumn"
132+ metal:use-macro="view/macro:page/main_only"
133 i18n:domain="launchpad"
134 >
135 <body>
136 <div metal:fill-slot="main">
137- <h1>Change your OpenPGP keys</h1>
138+ <h1 tal:content="view/label" />
139
140 <p tal:condition="view/error_message"
141 tal:content="structure view/error_message/escapedtext" class="error message"
142@@ -173,7 +170,7 @@
143 <input type="hidden" name="action" value="claim_gpg" />
144 <h2>Import an OpenPGP key</h2>
145
146- <p>To start using an OpenPGP key with your Launchpad account, simply paste its fingerprint below. (<a href="/+help/import-pgp-key.html" target="help">How to get the fingerprint</a>)
147+ <p>To start using an OpenPGP key with your Launchpad account, simply paste its fingerprint below. (<a href="/+help/import-pgp-key.html" target="help">How to get the fingerprint</a>)</p>
148
149 <table>
150 <tbody>
151@@ -190,11 +187,14 @@
152 </tbody>
153 </table>
154 <p>
155- Next, Launchpad will e-mail you using
156+ Next, Launchpad will send e-mail to you at
157 <code tal:content="context/preferredemail/email"/> with instructions
158 on finishing the process.
159 </p>
160- <div><input type="submit" name="import" value="Import Key"/></div>
161+ <div>
162+ <input type="submit" name="import" value="Import Key"/>
163+ or&nbsp; <a tal:attributes="href view/cancel_url">Cancel</a>
164+ </div>
165
166 </form>
167 </div>
168
169=== modified file 'lib/lp/registry/templates/person-editsshkeys.pt'
170--- lib/lp/registry/templates/person-editsshkeys.pt 2009-07-17 17:59:07 +0000
171+++ lib/lp/registry/templates/person-editsshkeys.pt 2009-09-08 00:28:41 +0000
172@@ -3,15 +3,12 @@
173 xmlns:tal="http://xml.zope.org/namespaces/tal"
174 xmlns:metal="http://xml.zope.org/namespaces/metal"
175 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
176- xml:lang="en"
177- lang="en"
178- dir="ltr"
179- metal:use-macro="view/macro:page/onecolumn"
180+ metal:use-macro="view/macro:page/main_only"
181 i18n:domain="launchpad"
182 >
183 <body>
184 <div metal:fill-slot="main">
185- <h1>Change your SSH keys</h1>
186+ <h1 tal:content="view/label" />
187
188 <p>
189 You need to register an SSH key with Launchpad to be able to publish
190@@ -55,11 +52,16 @@
191 <code>~/.ssh/id_dsa.pub</code> or <code>~/.ssh/id_rsa.pub</code>).
192 Only SSH v2 keys are supported.
193 <a href="https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair">
194- How do I get a public key?
195+ How do I create a public key?
196 </a>
197 </div>
198- <textarea name="sshkey" width="30" height="6"></textarea>
199- <input type="submit" value="Import Public Key" />
200+ <div>
201+ <textarea name="sshkey" cols="30" rows="12"></textarea>
202+ </div>
203+ <div style="margin-top: 0.5em;">
204+ <input type="submit" value="Import Public Key" />
205+ or&nbsp; <a tal:attributes="href view/cancel_url">Cancel</a>
206+ </div>
207 </div>
208 </form>
209 </div>
210
211=== modified file 'lib/lp/registry/templates/person-editwikinames.pt'
212--- lib/lp/registry/templates/person-editwikinames.pt 2009-07-17 17:59:07 +0000
213+++ lib/lp/registry/templates/person-editwikinames.pt 2009-09-08 00:28:41 +0000
214@@ -3,17 +3,13 @@
215 xmlns:tal="http://xml.zope.org/namespaces/tal"
216 xmlns:metal="http://xml.zope.org/namespaces/metal"
217 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
218- xml:lang="en"
219- lang="en"
220- dir="ltr"
221- metal:use-macro="context/@@main_template/master"
222+ metal:use-macro="view/macro:page/main_only"
223 i18n:domain="launchpad"
224 >
225 <body>
226
227 <div metal:fill-slot="main">
228-
229- <h1>Your wiki names</h1>
230+ <h1 tal:content="view/label" />
231
232 <p tal:condition="view/error_message"
233 tal:content="structure view/error_message/escapedtext"
234@@ -63,7 +59,7 @@
235 <tr>
236 <td colspan="2"><h2>New wiki name</h2></td>
237 </tr>
238-
239+
240 <tr>
241 <td><label>Wiki Base URL:</label></td>
242 <td><label>Wiki Name:</label></td>
243@@ -88,8 +84,8 @@
244
245 <div class="formControls">
246 <input type="submit" value="Save Changes" name="SAVE" />
247+ or&nbsp; <a tal:attributes="href view/cancel_url">Cancel</a>
248 </div>
249-
250 </form>
251 </div>
252