Repository: libcloud Updated Branches: refs/heads/trunk 1bf0f4784 -> 1aaaef957
Fix traceback when simplejson < 2.1.0 is installed See https://issues.apache.org/jira/browse/LIBCLOUD-714. Closes #577 Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1aaaef95 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1aaaef95 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1aaaef95 Branch: refs/heads/trunk Commit: 1aaaef95745cebf66a26128f3e74c13fa7361a90 Parents: 1bf0f47 Author: Erik Johnson <[email protected]> Authored: Fri Sep 11 08:53:58 2015 -0500 Committer: Tomaz Muraus <[email protected]> Committed: Fri Sep 11 16:25:25 2015 +0200 ---------------------------------------------------------------------- CHANGES.rst | 7 ++++++- libcloud/pricing.py | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/1aaaef95/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index 3fc74a7..5e5a563 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,12 +8,17 @@ General ~~~~~~~ - Update Rackspace AUTH_URL - [LIBCLOUD-738) + (LIBCLOUD-738) [Brian Curtin] - Fix ``LIBCLOUD_DEBUG`` mode so it works on Python 3.x. [Tomaz Muraus] +- Fix Libcloud code so it doesn't throw an exception if simplejson < 2.1.0 is + installed. + (LIBCLOUD-714, GITHUB-577) + [Erik Johnson] + Compute ~~~~~~~ http://git-wip-us.apache.org/repos/asf/libcloud/blob/1aaaef95/libcloud/pricing.py ---------------------------------------------------------------------- diff --git a/libcloud/pricing.py b/libcloud/pricing.py index cc2506f..42075fb 100644 --- a/libcloud/pricing.py +++ b/libcloud/pricing.py @@ -23,7 +23,11 @@ from os.path import join as pjoin try: import simplejson as json - JSONDecodeError = json.JSONDecodeError + try: + JSONDecodeError = json.JSONDecodeError + except AttributeError: + # simplejson < 2.1.0 does not have the JSONDecodeError exception class + JSONDecodeError = ValueError except ImportError: import json JSONDecodeError = ValueError
