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
=== modified file 'lib/canonical/launchpad/pagetitles.py'
--- lib/canonical/launchpad/pagetitles.py 2009-09-17 16:32:56 +0000
+++ lib/canonical/launchpad/pagetitles.py 2009-09-17 18:27:21 +0000
@@ -657,8 +657,6 @@
657person_answer_contact_for = ContextDisplayName(657person_answer_contact_for = ContextDisplayName(
658 'Projects for which %s is an answer contact')658 'Projects for which %s is an answer contact')
659659
660person_edit = ContextDisplayName(smartquote("%s's details"))
661
662# person_foaf is an rdf file660# person_foaf is an rdf file
663661
664person_hwdb_submissions = ContextDisplayName(662person_hwdb_submissions = ContextDisplayName(
665663
=== modified file 'lib/lp/registry/browser/person.py'
--- lib/lp/registry/browser/person.py 2009-09-17 16:12:20 +0000
+++ lib/lp/registry/browser/person.py 2009-09-17 18:48:15 +0000
@@ -3796,6 +3796,8 @@
37963796
3797 implements(IPersonEditMenu)3797 implements(IPersonEditMenu)
37983798
3799 label = 'Change your personal details'
3800
3799 # Will contain an hidden input when the user is renaming his3801 # Will contain an hidden input when the user is renaming his
3800 # account with full knowledge of the consequences.3802 # account with full knowledge of the consequences.
3801 i_know_this_is_an_openid_security_issue_input = None3803 i_know_this_is_an_openid_security_issue_input = None
38023804
=== renamed file 'lib/lp/registry/stories/foaf/xx-addemail.txt' => 'lib/lp/registry/stories/foaf/xx-add-email.txt'
--- 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 @@
77
8Sample Person will now add a couple email addresses to his account.8Sample Person will now add a couple email addresses to his account.
99
10 # Workaround while https://launchpad.net/launchpad/+bug/39016 is not
11 # fixed.
12 >>> from lp.services.mail import stub10 >>> from lp.services.mail import stub
13 >>> stub.test_emails[:] = []11 >>> assert not stub.test_emails, (
12 ... "stub.test_emails should be empty at the start of the test.")
1413
15 >>> browser = setupBrowser(auth='Basic test@canonical.com:test')14 >>> browser = setupBrowser(auth='Basic test@canonical.com:test')
16 >>> browser.open('http://launchpad.dev/~name12')15 >>> browser.open('http://launchpad.dev/~name12')
17 >>> browser.getLink('Change details').click()16 >>> browser.getLink(url='+editemails').click()
18 >>> browser.getLink('E-mail Settings').click()
19 >>> browser.url17 >>> browser.url
20 'http://launchpad.dev/~name12/+editemails'18 'http://launchpad.dev/~name12/+editemails'
2119
@@ -72,11 +70,10 @@
7270
73Now that the address is confirmed he sees it in the list of his confirmed71Now that the address is confirmed he sees it in the list of his confirmed
74addresses.72addresses.
75 73
76 >>> from canonical.launchpad.testing.pages import strip_label74 >>> from canonical.launchpad.testing.pages import strip_label
7775
78 >>> browser.getLink('Change details').click()76 >>> browser.getLink(url='+editemails').click()
79 >>> browser.getLink('E-mail Settings').click()
80 >>> confirmed = browser.getControl(name="field.VALIDATED_SELECTED")77 >>> confirmed = browser.getControl(name="field.VALIDATED_SELECTED")
81 >>> [strip_label(option) for option in confirmed.displayOptions]78 >>> [strip_label(option) for option in confirmed.displayOptions]
82 ['test@canonical.com', 'test2@canonical.com', 'testing@canonical.com']79 ['test@canonical.com', 'test2@canonical.com', 'testing@canonical.com']
8380
=== modified file 'lib/lp/registry/stories/foaf/xx-add-sshkey.txt'
--- lib/lp/registry/stories/foaf/xx-add-sshkey.txt 2009-09-16 17:56:17 +0000
+++ lib/lp/registry/stories/foaf/xx-add-sshkey.txt 2009-09-17 16:18:19 +0000
@@ -102,17 +102,6 @@
102 ...102 ...
103 Unauthorized: ...103 Unauthorized: ...
104104
105Nor is the option to edit the user's SSH keys displayed in the navigation
106menu:
107
108 >>> admin_browser.open('http://launchpad.dev/~salgado')
109 >>> admin_browser.getLink('Change details').click()
110 >>> print_navigation_links(admin_browser.contents)
111 Personal
112 E-mail Settings: .../~salgado/+editemails
113 OpenPGP Keys: .../~salgado/+editpgpkeys
114 Passwords: .../~salgado/+changepassword
115
116Salgado chooses to remove one of his ssh keys from Launchpad. The link105Salgado chooses to remove one of his ssh keys from Launchpad. The link
117to edit his keys is on the page.106to edit his keys is on the page.
118107
119108
=== renamed file 'lib/lp/registry/stories/foaf/xx-setpreferredemail.txt' => 'lib/lp/registry/stories/foaf/xx-set-preferredemail.txt'
--- lib/lp/registry/stories/foaf/xx-setpreferredemail.txt 2009-09-16 21:00:11 +0000
+++ lib/lp/registry/stories/foaf/xx-set-preferredemail.txt 2009-09-17 16:18:19 +0000
@@ -15,8 +15,7 @@
1515
16 >>> browser = setupBrowser(auth='Basic testing@canonical.com:test')16 >>> browser = setupBrowser(auth='Basic testing@canonical.com:test')
17 >>> browser.open('http://launchpad.dev/~name12')17 >>> browser.open('http://launchpad.dev/~name12')
18 >>> browser.getLink('Change details').click()18 >>> browser.getLink(url='+editemails').click()
19 >>> browser.getLink('E-mail Settings').click()
20 >>> print browser.url19 >>> print browser.url
21 http://launchpad.dev/~name12/+editemails20 http://launchpad.dev/~name12/+editemails
22 >>> print browser.title21 >>> print browser.title
2322
=== modified file 'lib/lp/registry/stories/foaf/xx-validate-email.txt'
--- lib/lp/registry/stories/foaf/xx-validate-email.txt 2009-09-16 21:00:11 +0000
+++ lib/lp/registry/stories/foaf/xx-validate-email.txt 2009-09-17 16:18:19 +0000
@@ -52,8 +52,7 @@
5252
53Check that the email address now shows up as validated.53Check that the email address now shows up as validated.
5454
55 >>> browser.getLink('Change details').click()55 >>> browser.getLink(url='+editemails').click()
56 >>> browser.getLink('E-mail Settings').click()
57 >>> browser.getControl(name="field.VALIDATED_SELECTED").getControl(56 >>> browser.getControl(name="field.VALIDATED_SELECTED").getControl(
58 ... value='salgado@ubuntu.com')57 ... value='salgado@ubuntu.com')
59 <ItemControl...optionValue='salgado@ubuntu.com'...>58 <ItemControl...optionValue='salgado@ubuntu.com'...>
6059
=== modified file 'lib/lp/registry/stories/gpg-coc/01-claimgpg.txt'
--- lib/lp/registry/stories/gpg-coc/01-claimgpg.txt 2009-09-10 20:12:12 +0000
+++ lib/lp/registry/stories/gpg-coc/01-claimgpg.txt 2009-09-17 16:18:19 +0000
@@ -20,8 +20,8 @@
20Start out with a clean page containing no imported keys:20Start out with a clean page containing no imported keys:
2121
22 >>> browser = setupBrowser(auth='Basic test@canonical.com:test')22 >>> browser = setupBrowser(auth='Basic test@canonical.com:test')
23 >>> browser.open("http://launchpad.dev/~name12/+edit")23 >>> browser.open("http://launchpad.dev/~name12")
24 >>> browser.getLink('OpenPGP Keys').click()24 >>> browser.getLink(url='+editpgpkeys').click()
25 >>> print browser.title25 >>> print browser.title
26 +editpgpkeys : Sample Person26 +editpgpkeys : Sample Person
2727
2828
=== modified file 'lib/lp/registry/stories/mailinglists/subscriptions.txt'
--- lib/lp/registry/stories/mailinglists/subscriptions.txt 2009-09-16 21:00:11 +0000
+++ lib/lp/registry/stories/mailinglists/subscriptions.txt 2009-09-17 18:12:42 +0000
@@ -83,8 +83,7 @@
83it's currently the team contact method.83it's currently the team contact method.
8484
85 >>> browser.open('http://launchpad.dev/~carlos')85 >>> browser.open('http://launchpad.dev/~carlos')
86 >>> browser.getLink("Change details").click()86 >>> browser.getLink(url="+editemails").click()
87 >>> browser.getLink("E-mail Settings").click()
8887
89 >>> from canonical.launchpad.helpers import backslashreplace88 >>> from canonical.launchpad.helpers import backslashreplace
90 >>> print backslashreplace(browser.title)89 >>> print backslashreplace(browser.title)
@@ -211,8 +210,7 @@
211Admins team, and he should know if the list is available.210Admins team, and he should know if the list is available.
212211
213 >>> browser.open('http://launchpad.dev/~carlos')212 >>> browser.open('http://launchpad.dev/~carlos')
214 >>> browser.getLink("Change details").click()213 >>> browser.getLink(url="+editemails").click()
215 >>> browser.getLink("E-mail Settings").click()
216 >>> print backslashreplace(browser.title)214 >>> print backslashreplace(browser.title)
217 +editemails : Carlos Perell\xf3 Mar\xedn215 +editemails : Carlos Perell\xf3 Mar\xedn
218216
@@ -245,8 +243,7 @@
245screen.243screen.
246244
247 >>> browser.open('http://launchpad.dev/~jdub')245 >>> browser.open('http://launchpad.dev/~jdub')
248 >>> browser.getLink("Change details").click()246 >>> browser.getLink(url="+editemails").click()
249 >>> browser.getLink("E-mail Settings").click()
250 >>> print browser.title247 >>> print browser.title
251 +editemails : Jeff Waugh248 +editemails : Jeff Waugh
252249
@@ -270,8 +267,7 @@
270His mailing list subscription is now available to be managed.267His mailing list subscription is now available to be managed.
271268
272 >>> browser.open('http://launchpad.dev/~jdub')269 >>> browser.open('http://launchpad.dev/~jdub')
273 >>> browser.getLink("Change details").click()270 >>> browser.getLink(url="+editemails").click()
274 >>> browser.getLink("E-mail Settings").click()
275 >>> print browser.title271 >>> print browser.title
276 +editemails : Jeff Waugh272 +editemails : Jeff Waugh
277273
@@ -346,8 +342,7 @@
346342
347 # Subscribe to the list using the normal technique.343 # Subscribe to the list using the normal technique.
348 >>> browser.open('http://launchpad.dev/~carlos')344 >>> browser.open('http://launchpad.dev/~carlos')
349 >>> browser.getLink("Change details").click()345 >>> browser.getLink(url="+editemails").click()
350 >>> browser.getLink("E-mail Settings").click()
351 >>> rosetta_admins = browser.getControl(346 >>> rosetta_admins = browser.getControl(
352 ... name='field.subscription.rosetta-admins')347 ... name='field.subscription.rosetta-admins')
353 >>> rosetta_admins.value = ['Preferred address']348 >>> rosetta_admins.value = ['Preferred address']
@@ -472,8 +467,7 @@
472467
473 >>> browser = setupBrowser(auth='Basic carlos@canonical.com:test')468 >>> browser = setupBrowser(auth='Basic carlos@canonical.com:test')
474 >>> browser.open('http://launchpad.dev/~carlos')469 >>> browser.open('http://launchpad.dev/~carlos')
475 >>> browser.getLink("Change details").click()470 >>> browser.getLink(url="+editemails").click()
476 >>> browser.getLink("E-mail Settings").click()
477 >>> print backslashreplace(browser.title)471 >>> print backslashreplace(browser.title)
478 +editemails : Carlos Perell\xf3 Mar\xedn472 +editemails : Carlos Perell\xf3 Mar\xedn
479473
@@ -551,8 +545,7 @@
551 ... auth='Basic james.blackwell@ubuntulinux.com:jblack')545 ... auth='Basic james.blackwell@ubuntulinux.com:jblack')
552546
553 >>> browser.open('http://launchpad.dev/~jblack')547 >>> browser.open('http://launchpad.dev/~jblack')
554 >>> browser.getLink("Change details").click()548 >>> browser.getLink(url="+editemails").click()
555 >>> browser.getLink("E-mail Settings").click()
556 >>> print_radio_button_field(browser.contents,549 >>> print_radio_button_field(browser.contents,
557 ... 'mailing_list_auto_subscribe_policy')550 ... 'mailing_list_auto_subscribe_policy')
558 ( ) Never subscribe to mailing lists551 ( ) Never subscribe to mailing lists
@@ -569,8 +562,7 @@
569562
570 # Change James' setting563 # Change James' setting
571 >>> browser.open('http://launchpad.dev/~jblack')564 >>> browser.open('http://launchpad.dev/~jblack')
572 >>> browser.getLink("Change details").click()565 >>> browser.getLink(url="+editemails").click()
573 >>> browser.getLink("E-mail Settings").click()
574 >>> set_autosubscribe_policy_and_submit('ALWAYS')566 >>> set_autosubscribe_policy_and_submit('ALWAYS')
575 ( ) Never subscribe to mailing lists567 ( ) Never subscribe to mailing lists
576 ( ) Ask me when I join a team568 ( ) Ask me when I join a team
@@ -586,8 +578,7 @@
586578
587 # Change James' setting579 # Change James' setting
588 >>> browser.open('http://launchpad.dev/~jblack')580 >>> browser.open('http://launchpad.dev/~jblack')
589 >>> browser.getLink("Change details").click()581 >>> browser.getLink(url="+editemails").click()
590 >>> browser.getLink("E-mail Settings").click()
591 >>> set_autosubscribe_policy_and_submit('NEVER')582 >>> set_autosubscribe_policy_and_submit('NEVER')
592 (*) Never subscribe to mailing lists583 (*) Never subscribe to mailing lists
593 ( ) Ask me when I join a team584 ( ) Ask me when I join a team
@@ -600,8 +591,7 @@
600591
601 # Restore James' setting.592 # Restore James' setting.
602 >>> browser.open('http://launchpad.dev/~jblack')593 >>> browser.open('http://launchpad.dev/~jblack')
603 >>> browser.getLink("Change details").click()594 >>> browser.getLink(url="+editemails").click()
604 >>> browser.getLink("E-mail Settings").click()
605 >>> set_autosubscribe_policy_and_submit('ON_REGISTRATION')595 >>> set_autosubscribe_policy_and_submit('ON_REGISTRATION')
606 ( ) Never subscribe to mailing lists596 ( ) Never subscribe to mailing lists
607 (*) Ask me when I join a team597 (*) Ask me when I join a team
608598
=== modified file 'lib/lp/registry/templates/person-edit.pt'
--- lib/lp/registry/templates/person-edit.pt 2009-07-17 17:59:07 +0000
+++ lib/lp/registry/templates/person-edit.pt 2009-09-17 18:48:15 +0000
@@ -3,16 +3,12 @@
3 xmlns:tal="http://xml.zope.org/namespaces/tal"3 xmlns:tal="http://xml.zope.org/namespaces/tal"
4 xmlns:metal="http://xml.zope.org/namespaces/metal"4 xmlns:metal="http://xml.zope.org/namespaces/metal"
5 xmlns:i18n="http://xml.zope.org/namespaces/i18n"5 xmlns:i18n="http://xml.zope.org/namespaces/i18n"
6 xml:lang="en"6 metal:use-macro="view/macro:page/main_only"
7 lang="en"
8 dir="ltr"
9 metal:use-macro="view/macro:page/onecolumn"
10 i18n:domain="launchpad"7 i18n:domain="launchpad"
11>8>
12 <body>9 <body>
13 <div metal:fill-slot="main"10 <div metal:fill-slot="main"
14 tal:define="overview_menu context/menu:overview">11 tal:define="overview_menu context/menu:overview">
15 <h1>Change your personal details</h1>
1612
17 <div metal:use-macro="context/@@launchpad_form/form">13 <div metal:use-macro="context/@@launchpad_form/form">
1814