Merge lp:~brian.curtin/ubuntu-sso-client/py3-urllib into lp:ubuntu-sso-client
Proposed by
Brian Curtin
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | dobey | ||||
Approved revision: | 982 | ||||
Merged at revision: | 982 | ||||
Proposed branch: | lp:~brian.curtin/ubuntu-sso-client/py3-urllib | ||||
Merge into: | lp:ubuntu-sso-client | ||||
Diff against target: |
339 lines (+82/-34) 9 files modified
ubuntu_sso/keyring/__init__.py (+9/-3) ubuntu_sso/keyring/linux.py (+10/-5) ubuntu_sso/tests/test_account.py (+2/-2) ubuntu_sso/utils/__init__.py (+11/-4) ubuntu_sso/utils/webclient/common.py (+7/-1) ubuntu_sso/utils/webclient/restful.py (+8/-2) ubuntu_sso/utils/webclient/tests/test_restful.py (+11/-5) ubuntu_sso/utils/webclient/tests/test_webclient.py (+14/-8) ubuntu_sso/utils/webclient/txweb.py (+10/-4) |
||||
To merge this branch: | bzr merge lp:~brian.curtin/ubuntu-sso-client/py3-urllib | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Approve | ||
Alejandro J. Cura (community) | Approve | ||
Review via email: mp+112429@code.launchpad.net |
Commit message
Try Python 3 urllib names and fall back to Python 2 as needed.
Description of the change
Python 3 reorganizes the urllib and urllib2 packages into a new structure, so we need to change our imports to work for both. Using the try/except dance, prefer the Python 3 way and fall back to the Python 2 way on ImportError.
In order to ease compatibility, some of the imports are changed to import names rather than the entire module, as there is no good way to write multi-version compatible code that imports the higher level names urllib or urllib2.
To post a comment you must log in.
== Python Lint Notices ==
ubuntu_ sso/gtk/ tests/test_ gui.py:
450: [W0511] FIXME - New GTK+ 3.5 breaks this check - see bug #1014772
ubuntu_ sso/main/ darwin. py:
60: [W0511] TODO
ubuntu_ sso/qt/ __init_ _.py:
50: [W0511] TODO
ubuntu_ sso/tests/ test_account. py:
35: [W0611] Unused import urllib2
ubuntu_ sso/utils/ __init_ _.py:
39: [F0401] Unable to import 'urllib.parse'
39: [E0611] No name 'parse' in module 'urllib'
40: [F0401] Unable to import 'urllib.request'
40: [E0611] No name 'request' in module 'urllib'
ubuntu_ sso/utils/ webclient/ common. py:
284: [W0511] TODO
40: [F0401] Unable to import 'urllib.parse'
40: [E0611] No name 'parse' in module 'urllib'
ubuntu_ sso/utils/ webclient/ restful. py:
34: [F0401] Unable to import 'urllib.parse'
34: [E0611] No name 'parse' in module 'urllib'
ubuntu_ sso/utils/ webclient/ tests/test_ restful. py: stCase. test_restful_ namespace_ added_to_ url] Instance of 'ParseResult' has no 'path' member (but some types could not be inferred)
34: [F0401] Unable to import 'urllib.parse'
34: [E0611] No name 'parse' in module 'urllib'
128: [E1103, RestfulClientTe
ubuntu_ sso/utils/ webclient/ tests/test_ webclient. py:
37: [F0401] Unable to import 'urllib.parse'
37: [E0611] No name 'parse' in module 'urllib'
ubuntu_ sso/utils/ webclient/ txweb.py: raw_request] Instance of 'ParseResult' has no 'scheme' member (but some types could not be inferred) raw_request] Instance of 'ParseResult' has no 'netloc' member (but some types could not be inferred)
34: [F0401] Unable to import 'urllib.parse'
34: [E0611] No name 'parse' in module 'urllib'
102: [E1103, WebClient.
103: [E1103, WebClient.