Merge lp://staging/~brian.curtin/ubuntu-sso-client/py3-unicode into lp://staging/ubuntu-sso-client
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Alejandro J. Cura | ||||
Approved revision: | 998 | ||||
Merged at revision: | 987 | ||||
Proposed branch: | lp://staging/~brian.curtin/ubuntu-sso-client/py3-unicode | ||||
Merge into: | lp://staging/ubuntu-sso-client | ||||
Diff against target: |
470 lines (+118/-53) 9 files modified
ubuntu_sso/account.py (+12/-10) ubuntu_sso/credentials.py (+3/-3) ubuntu_sso/keyring/__init__.py (+13/-8) ubuntu_sso/keyring/tests/test_common.py (+11/-9) ubuntu_sso/keyring/tests/test_linux.py (+3/-1) ubuntu_sso/main/__init__.py (+2/-1) ubuntu_sso/main/tests/test_common.py (+5/-3) ubuntu_sso/tests/test_account.py (+20/-18) ubuntu_sso/utils/compat.py (+49/-0) |
||||
To merge this branch: | bzr merge lp://staging/~brian.curtin/ubuntu-sso-client/py3-unicode | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Mike McCracken (community) | Approve | ||
Alejandro J. Cura (community) | Approve | ||
Review via email: mp+112856@code.staging.launchpad.net |
Commit message
The first of several changes to prepare sso for Python 3 Unicode usage
Description of the change
The first of several branches which prepare our code to work with both Python 2 and 3 with respect to Unicode. Since we support Python 2.6 and beyond as well as Python 3, we make use of the "from __future__ import unicode_literals" compile change, which makes things a lot easier.
In addition, I introduced ubuntu_
(compat may make sense to move into something like devtools at a later time. I figure it's best to keep small changes self-contained for the time being before we do any cross-project changes)
This change covers modules in the following packages:
ubuntu_sso
ubuntu_sso.gtk
ubuntu_sso.keyring
ubuntu_sso.main
This series of py3k branches is looking awesome, thanks for working on it!
One thing we should consider: in every file where we add the "from __future__ import unicode_literals" we should be extra careful about the string literals that we are not turning from u"..." to "...".
I can see two different cases happening here: sso/keyring/ tests/test_ common. py that fake some functions that will still return bytes on py3.
* In some places the old code assumes that conversions when comparing unicode with str are automatic, so to make this work on 3 we should leave old string literal as they are.
* In some other places some old string literals should be changed from "..." to "...".encode(...), because they are truly using "byte literals". For instance in many of the tests in ubuntu_