Import from urllib in Python 2 and 3 friendly ways
Bug #1039255 reported by
Brian Curtin
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
ubuntuone-dev-tools | Status tracked in Trunk | |||||
Stable-4-0 |
Fix Released
|
Undecided
|
Unassigned | |||
Trunk |
Fix Released
|
Undecided
|
Brian Curtin | |||
ubuntuone-dev-tools (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned | |||
Quantal |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Python 3 reorganized the urllib package so some names come from different packages in Python 3 as compared to Python 2. We should try to import the Python 3 name and fall back to Python 2 imports on an ImportError.
Related branches
lp:~brian.curtin/ubuntuone-dev-tools/py3-urllib
- Roberto Alsina (community): Approve
- Alejandro J. Cura (community): Approve
-
Diff: 56 lines (+21/-3)3 files modifiedubuntuone/devtools/services/dbus.py (+7/-1)
ubuntuone/devtools/services/tests/test_dbus.py (+7/-1)
ubuntuone/devtools/testcases/dbus.py (+7/-1)
To post a comment you must log in.
This bug was fixed in the package ubuntuone-dev-tools - 3.99.90-0ubuntu1
---------------
ubuntuone-dev-tools (3.99.90-0ubuntu1) quantal; urgency=low
* New upstream release.
- Coerce map usage into lists for both Python versions. (LP: #1042384)
- Enable the tests to be manually run against Python 3. (LP: #1042436)
- Enable unicode_literals for text/bytes distinction. (LP: #1039741)
- Prepare u1lint for Python 3 usage. (LP: #1040144)
- Convert unicode usage to use the compatibility layer. (LP: #1039765)
- Update octal literal use for Python 3. (LP: #1039749)
- Import StringIO from the io module for compatibility. (LP: #1039262)
- Use items instead of iteritems for Python 3. (LP: #1039267)
- Adjust exception handling to work on Python 3. (LP: #1039265)
- Change to Python 3's print function syntax. (LP: #1039238)
- Move long usage to int. (LP: #1039251)
- Fix urllib imports to work on both Python versions. (LP: #1039255)
- Add a small module for Unicode/bytes distinction. (LP: #1039225)
- Replace xrange usage with range. (LP: #1039243)
-- Rodney Dawes <email address hidden> Wed, 29 Aug 2012 09:46:24 -0400