launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #26257
[Merge] ~cjwatson/launchpad:py3-launchbag-login-text into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-launchbag-login-text into launchpad:master.
Commit message:
Store LaunchBag.login as text, not bytes
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/397705
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-launchbag-login-text into launchpad:master.
diff --git a/lib/lp/services/mail/doc/emailauthentication.txt b/lib/lp/services/mail/doc/emailauthentication.txt
index 923fb15..48427bb 100644
--- a/lib/lp/services/mail/doc/emailauthentication.txt
+++ b/lib/lp/services/mail/doc/emailauthentication.txt
@@ -47,8 +47,8 @@ user in the launch bag:
>>> from_user = getUtility(IPersonSet).getByEmail(addr)
>>> launchbag.user == from_user
True
- >>> launchbag.login
- 'test@xxxxxxxxxxxxx'
+ >>> print(launchbag.login)
+ test@xxxxxxxxxxxxx
In the above email the GPG signature was detached from the actual
message. Inline signatures are supported as well.
@@ -61,8 +61,8 @@ message. Inline signatures are supported as well.
>>> from_user = getUtility(IPersonSet).getByEmail(addr)
>>> launchbag.user == from_user
True
- >>> launchbag.login
- 'test@xxxxxxxxxxxxx'
+ >>> print(launchbag.login)
+ test@xxxxxxxxxxxxx
As well as signed multipart messages:
@@ -74,8 +74,8 @@ As well as signed multipart messages:
>>> from_user = getUtility(IPersonSet).getByEmail(addr)
>>> launchbag.user == from_user
True
- >>> launchbag.login
- 'foo.bar@xxxxxxxxxxxxx'
+ >>> print(launchbag.login)
+ foo.bar@xxxxxxxxxxxxx
When dealing with inline signatures, lines that begin with a '-'
character in the signed content are required to be escaped, so we need
@@ -89,8 +89,8 @@ to deal with it if we receive a dash escaped message.
>>> from_user = getUtility(IPersonSet).getByEmail(addr)
>>> launchbag.user == from_user
True
- >>> launchbag.login
- 'test@xxxxxxxxxxxxx'
+ >>> print(launchbag.login)
+ test@xxxxxxxxxxxxx
If the signature is invalid, that is it won't verify properly,
InvalidSignature will be raised:
@@ -192,8 +192,8 @@ An unsigned email:
>>> print(launchbag.user.displayname)
Foo Bar
- >>> launchbag.login
- 'foo.bar@xxxxxxxxxxxxx'
+ >>> print(launchbag.login)
+ foo.bar@xxxxxxxxxxxxx
An email which is signed with a key that isn't associated with the
authenticated user:
@@ -205,8 +205,8 @@ authenticated user:
>>> print(launchbag.user.displayname)
Sample Person
- >>> launchbag.login
- 'testing@xxxxxxxxxxxxx'
+ >>> print(launchbag.login)
+ testing@xxxxxxxxxxxxx
Of course, if the email is signed with a key which is associated with
the user, IWeaklyAuthenticatedPrincipal won't be provided by the
@@ -219,5 +219,5 @@ principal.
>>> print(launchbag.user.displayname)
Sample Person
- >>> launchbag.login
- 'test@xxxxxxxxxxxxx'
+ >>> print(launchbag.login)
+ test@xxxxxxxxxxxxx
diff --git a/lib/lp/services/webapp/launchbag.py b/lib/lp/services/webapp/launchbag.py
index e664954..b1f2e2e 100644
--- a/lib/lp/services/webapp/launchbag.py
+++ b/lib/lp/services/webapp/launchbag.py
@@ -58,6 +58,8 @@ class LaunchBag:
def setLogin(self, login):
'''See IOpenLaunchBag.'''
+ if isinstance(login, bytes):
+ login = login.decode('UTF-8')
self._store.login = login
@property