Merge lp:~bac/launchpad/bug-432026-person-edit into lp:launchpad

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

= Summary =

The person-edit.pt template needs to be converted, as stated in bug 432026.

== Proposed fix ==

Simple conversion of the template and then fixing failed tests.

== Pre-implementation notes ==

Brief chat with Curtis.

== Implementation details ==

In the old page there were navigation lozenges that linked to lower edit pages, e.g.
for editing emails, wikiname, etc. A lot of the pagetest tested going to the 'Change
details' page and then navigating to correct page. The links to the individual edit
pages are now available off the person index page. The tests were changed to go
directly to the lower edit page, which saves a page load, which will make Julian happy.

A few tests were renamed for consistency.

== Tests ==

Run all of the registry tests:
bin/test -vvm lp.registry

== Demo and Q/A ==

https://launchpad.dev/~mark and click on 'Change details'.

= Launchpad lint =

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

Linting changed files:
  lib/lp/registry/stories/mailinglists/subscriptions.txt
  lib/canonical/launchpad/pagetitles.py
  lib/lp/registry/stories/foaf/xx-validate-email.txt
  lib/lp/registry/stories/foaf/xx-add-sshkey.txt
  lib/lp/registry/stories/foaf/xx-set-preferredemail.txt
  lib/lp/registry/stories/foaf/xx-add-email.txt
  lib/lp/registry/stories/gpg-coc/01-claimgpg.txt
  lib/lp/registry/browser/person.py
  lib/lp/registry/templates/person-edit.pt

== Pylint notices ==

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

--
Brad Crittenden
<email address hidden>

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

Thanks for doing this Brad.

This branch looks fine to land. I have a few suggestions, but don't let them stop you from landing the code today.

> === renamed file 'lib/lp/registry/stories/foaf/xx-addemail.txt' => 'lib/lp/registry/stories/foaf/xx-add-email.txt'

I like the rename.

> --- lib/lp/registry/stories/foaf/xx-addemail.txt 2009-05-12 01:39:29 +0000
> +++ lib/lp/registry/stories/foaf/xx-add-email.txt 2009-09-17 16:18:19 +0000
> @@ -7,15 +7,13 @@
>
> Sample Person will now add a couple email addresses to his account.
>
> - # Workaround while https://launchpad.net/launchpad/+bug/39016 is not
> - # fixed.
> >>> from lp.services.mail import stub
> - >>> stub.test_emails[:] = []
> + >>> assert not stub.test_emails, (
> + ... "stub.test_emails should be empty at the start of the test.")

You can remove the assert. The problem was fixed a long time ago and lots
of tests use the stub without clearing it.

> >>> browser = setupBrowser(auth='Basic <email address hidden>:test')
> >>> browser.open('http://launchpad.dev/~name12')
> - >>> browser.getLink('Change details').click()
> - >>> browser.getLink('E-mail Settings').click()
> + >>> browser.getLink(url='+editemails').click()

This is fine as it is, but I usually use the alt text of an image to get the
link.

    >>> browser.getLink('Change e-mail settings').click()

^ Did that not work?

review: Approve (code)
Revision history for this message
Brad Crittenden (bac) wrote :

On Sep 17, 2009, at 15:53 , Curtis Hovey wrote:

> Review: Approve code
> Thanks for doing this Brad.
>
> This branch looks fine to land. I have a few suggestions, but don't
> let them stop you from landing the code today.
>
>> === renamed file 'lib/lp/registry/stories/foaf/xx-addemail.txt' =>
>> 'lib/lp/registry/stories/foaf/xx-add-email.txt'
>
> I like the rename.
>
>> --- lib/lp/registry/stories/foaf/xx-addemail.txt 2009-05-12
>> 01:39:29 +0000
>> +++ lib/lp/registry/stories/foaf/xx-add-email.txt 2009-09-17
>> 16:18:19 +0000
>> @@ -7,15 +7,13 @@
>>
>> Sample Person will now add a couple email addresses to his account.
>>
>> - # Workaround while https://launchpad.net/launchpad/+bug/39016
>> is not
>> - # fixed.
>>>>> from lp.services.mail import stub
>> - >>> stub.test_emails[:] = []
>> + >>> assert not stub.test_emails, (
>> + ... "stub.test_emails should be empty at the start of the
>> test.")
>
> You can remove the assert. The problem was fixed a long time ago and
> lots
> of tests use the stub without clearing it.

Great. We're not so good about cleaning up old XXX work-arounds and
comments.

>
>>>>> browser = setupBrowser(auth='Basic <email address hidden>:test')
>>>>> browser.open('http://launchpad.dev/~name12')
>> - >>> browser.getLink('Change details').click()
>> - >>> browser.getLink('E-mail Settings').click()
>> + >>> browser.getLink(url='+editemails').click()
>
> This is fine as it is, but I usually use the alt text of an image to
> get the
> link.

I'll leave this test as is but keep that in mind.

>
>>>> browser.getLink('Change e-mail settings').click()
>
> ^ Did that not work?

Didn't try it. I'll have a go next time around.

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-17 16:32:56 +0000
3+++ lib/canonical/launchpad/pagetitles.py 2009-09-17 18:27:21 +0000
4@@ -657,8 +657,6 @@
5 person_answer_contact_for = ContextDisplayName(
6 'Projects for which %s is an answer contact')
7
8-person_edit = ContextDisplayName(smartquote("%s's details"))
9-
10 # person_foaf is an rdf file
11
12 person_hwdb_submissions = ContextDisplayName(
13
14=== modified file 'lib/lp/registry/browser/person.py'
15--- lib/lp/registry/browser/person.py 2009-09-17 16:12:20 +0000
16+++ lib/lp/registry/browser/person.py 2009-09-17 18:48:15 +0000
17@@ -3796,6 +3796,8 @@
18
19 implements(IPersonEditMenu)
20
21+ label = 'Change your personal details'
22+
23 # Will contain an hidden input when the user is renaming his
24 # account with full knowledge of the consequences.
25 i_know_this_is_an_openid_security_issue_input = None
26
27=== renamed file 'lib/lp/registry/stories/foaf/xx-addemail.txt' => 'lib/lp/registry/stories/foaf/xx-add-email.txt'
28--- lib/lp/registry/stories/foaf/xx-addemail.txt 2009-05-12 01:39:29 +0000
29+++ lib/lp/registry/stories/foaf/xx-add-email.txt 2009-09-17 16:18:19 +0000
30@@ -7,15 +7,13 @@
31
32 Sample Person will now add a couple email addresses to his account.
33
34- # Workaround while https://launchpad.net/launchpad/+bug/39016 is not
35- # fixed.
36 >>> from lp.services.mail import stub
37- >>> stub.test_emails[:] = []
38+ >>> assert not stub.test_emails, (
39+ ... "stub.test_emails should be empty at the start of the test.")
40
41 >>> browser = setupBrowser(auth='Basic test@canonical.com:test')
42 >>> browser.open('http://launchpad.dev/~name12')
43- >>> browser.getLink('Change details').click()
44- >>> browser.getLink('E-mail Settings').click()
45+ >>> browser.getLink(url='+editemails').click()
46 >>> browser.url
47 'http://launchpad.dev/~name12/+editemails'
48
49@@ -72,11 +70,10 @@
50
51 Now that the address is confirmed he sees it in the list of his confirmed
52 addresses.
53-
54+
55 >>> from canonical.launchpad.testing.pages import strip_label
56
57- >>> browser.getLink('Change details').click()
58- >>> browser.getLink('E-mail Settings').click()
59+ >>> browser.getLink(url='+editemails').click()
60 >>> confirmed = browser.getControl(name="field.VALIDATED_SELECTED")
61 >>> [strip_label(option) for option in confirmed.displayOptions]
62 ['test@canonical.com', 'test2@canonical.com', 'testing@canonical.com']
63
64=== modified file 'lib/lp/registry/stories/foaf/xx-add-sshkey.txt'
65--- lib/lp/registry/stories/foaf/xx-add-sshkey.txt 2009-09-16 17:56:17 +0000
66+++ lib/lp/registry/stories/foaf/xx-add-sshkey.txt 2009-09-17 16:18:19 +0000
67@@ -102,17 +102,6 @@
68 ...
69 Unauthorized: ...
70
71-Nor is the option to edit the user's SSH keys displayed in the navigation
72-menu:
73-
74- >>> admin_browser.open('http://launchpad.dev/~salgado')
75- >>> admin_browser.getLink('Change details').click()
76- >>> print_navigation_links(admin_browser.contents)
77- Personal
78- E-mail Settings: .../~salgado/+editemails
79- OpenPGP Keys: .../~salgado/+editpgpkeys
80- Passwords: .../~salgado/+changepassword
81-
82 Salgado chooses to remove one of his ssh keys from Launchpad. The link
83 to edit his keys is on the page.
84
85
86=== renamed file 'lib/lp/registry/stories/foaf/xx-setpreferredemail.txt' => 'lib/lp/registry/stories/foaf/xx-set-preferredemail.txt'
87--- lib/lp/registry/stories/foaf/xx-setpreferredemail.txt 2009-09-16 21:00:11 +0000
88+++ lib/lp/registry/stories/foaf/xx-set-preferredemail.txt 2009-09-17 16:18:19 +0000
89@@ -15,8 +15,7 @@
90
91 >>> browser = setupBrowser(auth='Basic testing@canonical.com:test')
92 >>> browser.open('http://launchpad.dev/~name12')
93- >>> browser.getLink('Change details').click()
94- >>> browser.getLink('E-mail Settings').click()
95+ >>> browser.getLink(url='+editemails').click()
96 >>> print browser.url
97 http://launchpad.dev/~name12/+editemails
98 >>> print browser.title
99
100=== modified file 'lib/lp/registry/stories/foaf/xx-validate-email.txt'
101--- lib/lp/registry/stories/foaf/xx-validate-email.txt 2009-09-16 21:00:11 +0000
102+++ lib/lp/registry/stories/foaf/xx-validate-email.txt 2009-09-17 16:18:19 +0000
103@@ -52,8 +52,7 @@
104
105 Check that the email address now shows up as validated.
106
107- >>> browser.getLink('Change details').click()
108- >>> browser.getLink('E-mail Settings').click()
109+ >>> browser.getLink(url='+editemails').click()
110 >>> browser.getControl(name="field.VALIDATED_SELECTED").getControl(
111 ... value='salgado@ubuntu.com')
112 <ItemControl...optionValue='salgado@ubuntu.com'...>
113
114=== modified file 'lib/lp/registry/stories/gpg-coc/01-claimgpg.txt'
115--- lib/lp/registry/stories/gpg-coc/01-claimgpg.txt 2009-09-10 20:12:12 +0000
116+++ lib/lp/registry/stories/gpg-coc/01-claimgpg.txt 2009-09-17 16:18:19 +0000
117@@ -20,8 +20,8 @@
118 Start out with a clean page containing no imported keys:
119
120 >>> browser = setupBrowser(auth='Basic test@canonical.com:test')
121- >>> browser.open("http://launchpad.dev/~name12/+edit")
122- >>> browser.getLink('OpenPGP Keys').click()
123+ >>> browser.open("http://launchpad.dev/~name12")
124+ >>> browser.getLink(url='+editpgpkeys').click()
125 >>> print browser.title
126 +editpgpkeys : Sample Person
127
128
129=== modified file 'lib/lp/registry/stories/mailinglists/subscriptions.txt'
130--- lib/lp/registry/stories/mailinglists/subscriptions.txt 2009-09-16 21:00:11 +0000
131+++ lib/lp/registry/stories/mailinglists/subscriptions.txt 2009-09-17 18:12:42 +0000
132@@ -83,8 +83,7 @@
133 it's currently the team contact method.
134
135 >>> browser.open('http://launchpad.dev/~carlos')
136- >>> browser.getLink("Change details").click()
137- >>> browser.getLink("E-mail Settings").click()
138+ >>> browser.getLink(url="+editemails").click()
139
140 >>> from canonical.launchpad.helpers import backslashreplace
141 >>> print backslashreplace(browser.title)
142@@ -211,8 +210,7 @@
143 Admins team, and he should know if the list is available.
144
145 >>> browser.open('http://launchpad.dev/~carlos')
146- >>> browser.getLink("Change details").click()
147- >>> browser.getLink("E-mail Settings").click()
148+ >>> browser.getLink(url="+editemails").click()
149 >>> print backslashreplace(browser.title)
150 +editemails : Carlos Perell\xf3 Mar\xedn
151
152@@ -245,8 +243,7 @@
153 screen.
154
155 >>> browser.open('http://launchpad.dev/~jdub')
156- >>> browser.getLink("Change details").click()
157- >>> browser.getLink("E-mail Settings").click()
158+ >>> browser.getLink(url="+editemails").click()
159 >>> print browser.title
160 +editemails : Jeff Waugh
161
162@@ -270,8 +267,7 @@
163 His mailing list subscription is now available to be managed.
164
165 >>> browser.open('http://launchpad.dev/~jdub')
166- >>> browser.getLink("Change details").click()
167- >>> browser.getLink("E-mail Settings").click()
168+ >>> browser.getLink(url="+editemails").click()
169 >>> print browser.title
170 +editemails : Jeff Waugh
171
172@@ -346,8 +342,7 @@
173
174 # Subscribe to the list using the normal technique.
175 >>> browser.open('http://launchpad.dev/~carlos')
176- >>> browser.getLink("Change details").click()
177- >>> browser.getLink("E-mail Settings").click()
178+ >>> browser.getLink(url="+editemails").click()
179 >>> rosetta_admins = browser.getControl(
180 ... name='field.subscription.rosetta-admins')
181 >>> rosetta_admins.value = ['Preferred address']
182@@ -472,8 +467,7 @@
183
184 >>> browser = setupBrowser(auth='Basic carlos@canonical.com:test')
185 >>> browser.open('http://launchpad.dev/~carlos')
186- >>> browser.getLink("Change details").click()
187- >>> browser.getLink("E-mail Settings").click()
188+ >>> browser.getLink(url="+editemails").click()
189 >>> print backslashreplace(browser.title)
190 +editemails : Carlos Perell\xf3 Mar\xedn
191
192@@ -551,8 +545,7 @@
193 ... auth='Basic james.blackwell@ubuntulinux.com:jblack')
194
195 >>> browser.open('http://launchpad.dev/~jblack')
196- >>> browser.getLink("Change details").click()
197- >>> browser.getLink("E-mail Settings").click()
198+ >>> browser.getLink(url="+editemails").click()
199 >>> print_radio_button_field(browser.contents,
200 ... 'mailing_list_auto_subscribe_policy')
201 ( ) Never subscribe to mailing lists
202@@ -569,8 +562,7 @@
203
204 # Change James' setting
205 >>> browser.open('http://launchpad.dev/~jblack')
206- >>> browser.getLink("Change details").click()
207- >>> browser.getLink("E-mail Settings").click()
208+ >>> browser.getLink(url="+editemails").click()
209 >>> set_autosubscribe_policy_and_submit('ALWAYS')
210 ( ) Never subscribe to mailing lists
211 ( ) Ask me when I join a team
212@@ -586,8 +578,7 @@
213
214 # Change James' setting
215 >>> browser.open('http://launchpad.dev/~jblack')
216- >>> browser.getLink("Change details").click()
217- >>> browser.getLink("E-mail Settings").click()
218+ >>> browser.getLink(url="+editemails").click()
219 >>> set_autosubscribe_policy_and_submit('NEVER')
220 (*) Never subscribe to mailing lists
221 ( ) Ask me when I join a team
222@@ -600,8 +591,7 @@
223
224 # Restore James' setting.
225 >>> browser.open('http://launchpad.dev/~jblack')
226- >>> browser.getLink("Change details").click()
227- >>> browser.getLink("E-mail Settings").click()
228+ >>> browser.getLink(url="+editemails").click()
229 >>> set_autosubscribe_policy_and_submit('ON_REGISTRATION')
230 ( ) Never subscribe to mailing lists
231 (*) Ask me when I join a team
232
233=== modified file 'lib/lp/registry/templates/person-edit.pt'
234--- lib/lp/registry/templates/person-edit.pt 2009-07-17 17:59:07 +0000
235+++ lib/lp/registry/templates/person-edit.pt 2009-09-17 18:48:15 +0000
236@@ -3,16 +3,12 @@
237 xmlns:tal="http://xml.zope.org/namespaces/tal"
238 xmlns:metal="http://xml.zope.org/namespaces/metal"
239 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
240- xml:lang="en"
241- lang="en"
242- dir="ltr"
243- metal:use-macro="view/macro:page/onecolumn"
244+ metal:use-macro="view/macro:page/main_only"
245 i18n:domain="launchpad"
246 >
247 <body>
248 <div metal:fill-slot="main"
249 tal:define="overview_menu context/menu:overview">
250- <h1>Change your personal details</h1>
251
252 <div metal:use-macro="context/@@launchpad_form/form">
253