Merge ~cjwatson/launchpad:python-openid2-3.2+lp1 into launchpad:master

Proposed by Colin Watson on 2020-08-17
Status: Merged
Approved by: Colin Watson on 2020-08-18
Approved revision: 4df8f714578c3ab8ba91746d4035ef5ccdf9824d
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:python-openid2-3.2+lp1
Merge into: launchpad:master
Diff against target: 56 lines (+36/-1)
2 files modified
constraints.txt (+3/-1)
lib/lp/services/webapp/tests/login.txt (+33/-0)
Reviewer Review Type Date Requested Status
Tom Wardill 2020-08-17 Approve on 2020-08-18
Review via email: mp+389437@code.launchpad.net

Commit message

Fix login for users with non-ASCII display names

To post a comment you must log in.
Tom Wardill (twom) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/constraints.txt b/constraints.txt
2index 00eecfa..8a9077d 100644
3--- a/constraints.txt
4+++ b/constraints.txt
5@@ -278,7 +278,9 @@ python-dateutil==2.8.1
6 python-debian==0.1.32
7 python-keystoneclient==0.7.1
8 python-memcached==1.58
9-python-openid2==3.2
10+# https://github.com/ziima/python-openid/pull/47
11+# lp1 Fix normalization of non-ASCII query strings on Python 2.
12+python-openid2==3.2+lp1
13 python-swiftclient==2.0.3
14 PyYAML==3.10
15 rabbitfixture==0.4.2
16diff --git a/lib/lp/services/webapp/tests/login.txt b/lib/lp/services/webapp/tests/login.txt
17index ec6eeed..5b81348 100644
18--- a/lib/lp/services/webapp/tests/login.txt
19+++ b/lib/lp/services/webapp/tests/login.txt
20@@ -49,3 +49,36 @@ logged in and ask us to log out if we're somebody else.
21 >>> browser.open('%s/+login' % root_url)
22 >>> print extract_text(find_main_content(browser.contents))
23 You are already logged in...
24+
25+The same thing works if the user has non-ASCII characters in their display
26+name.
27+
28+ >>> from lp.testing import (
29+ ... ANONYMOUS,
30+ ... login,
31+ ... )
32+ >>> from lp.testing.factory import LaunchpadObjectFactory
33+
34+ >>> login(ANONYMOUS)
35+ >>> factory = LaunchpadObjectFactory()
36+ >>> person = factory.makePerson(
37+ ... email='unicode@example.com', name='unicode',
38+ ... displayname=u'Un\xedc\xf6de Person')
39+ >>> browser = Browser()
40+ >>> browser.handleErrors = True
41+ >>> browser.open(
42+ ... '%s/people/?name=foo&searchfor=all' % root_url)
43+ >>> browser.getLink('Log in / Register').click()
44+ >>> print browser.contents
45+ <html>...<body onload="document.forms[0].submit();"...
46+ >>> browser.getControl('Continue').click()
47+ >>> print browser.title
48+ Login
49+ >>> fill_login_form_and_submit(browser, 'unicode@example.com')
50+ >>> browser.vhost
51+ 'http://launchpad.test'
52+ >>> browser.urlpath
53+ '/people'
54+ >>> import re
55+ >>> print sorted(re.sub('.*\?', '', browser.url).split('&'))
56+ ['name=foo', 'searchfor=all']

Subscribers

People subscribed via source and target branches

to status/vote changes: