Merge lp:~brian.curtin/ubuntu-sso-client/py3-unicode into lp:ubuntu-sso-client
| Status: | Merged | ||||
|---|---|---|---|---|---|
| Approved by: | Alejandro J. Cura on 2012-07-31 | ||||
| Approved revision: | 998 | ||||
| Merged at revision: | 987 | ||||
| Proposed branch: | lp:~brian.curtin/ubuntu-sso-client/py3-unicode | ||||
| Merge into: | lp: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:~brian.curtin/ubuntu-sso-client/py3-unicode | ||||
| Related bugs: |
|
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Mike McCracken (community) | Approve on 2012-07-31 | ||
| Alejandro J. Cura (community) | 2012-06-29 | Approve on 2012-07-24 | |
|
Review via email:
|
|||
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
| Brian Curtin (brian.curtin) wrote : | # |
I think the above changes should have this addressed. Rather than changing the tests, I made the implementation more Python 3 safe. keyring.gethostname actually would not work on 3 anyway.
| Alejandro J. Cura (alecu) wrote : | # |
== Python Lint Notices ==
ubuntu_
50: [W0511] TODO
ubuntu_
42: [W0622] Redefining built-in 'basestring'
40: [C0103] Invalid name "text_type" (should match (([A-Z_
41: [C0103] Invalid name "binary_type" (should match (([A-Z_
42: [C0103] Invalid name "basestring" (should match (([A-Z_
44: [C0103] Invalid name "text_type" (should match (([A-Z_
45: [C0103] Invalid name "binary_type" (should match (([A-Z_
46: [C0103] Invalid name "basestring" (should match (([A-Z_
ubuntu_
286: [W0511] TODO
| Alejandro J. Cura (alecu) wrote : | # |
Other than lint issues, I've run the tests on Ubuntu, and ran the sso client irl, and it seems to be working fine.
- 998. By Brian Curtin on 2012-07-24
-
Disable lint warnings for basestring redefine, invalid names

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_