summaryrefslogtreecommitdiffstats
path: root/openstack
diff options
context:
space:
mode:
authorTim Daly Jr <timjr@yahoo-inc.com>2012-06-26 02:48:42 +0000
committerTim Daly Jr <timjr@yahoo-inc.com>2012-06-26 02:48:51 +0000
commit4c9d439ef24f5afdd74aa9153aa8fc772051e6cb (patch)
tree11d4991dc74b11ae4019a367a69274d0a56e3a41 /openstack
parent5a93e1d790422ddf21c223ec77b0355e6b790021 (diff)
downloadoslo-4c9d439ef24f5afdd74aa9153aa8fc772051e6cb.tar.gz
oslo-4c9d439ef24f5afdd74aa9153aa8fc772051e6cb.tar.xz
oslo-4c9d439ef24f5afdd74aa9153aa8fc772051e6cb.zip
Add 'filedecoder' method to the jsonutils wrapper module.
Fixes bug #1017765 After version 3.3.2, the anyjson library will throw a KeyError if filedecoder isn't present. The filedecoder is just like the decoder except it takes a file instead of a string, like json.load() instead of json.loads(). Change-Id: I7bd012a7b4afa9b1ec987c3e6393cc922b5dadff
Diffstat (limited to 'openstack')
-rw-r--r--openstack/common/jsonutils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/openstack/common/jsonutils.py b/openstack/common/jsonutils.py
index 7522669..11b7e1e 100644
--- a/openstack/common/jsonutils.py
+++ b/openstack/common/jsonutils.py
@@ -130,11 +130,15 @@ def loads(s):
return json.loads(s)
+def load(s):
+ return json.load(s)
+
+
try:
import anyjson
except ImportError:
pass
else:
anyjson._modules.append((__name__, 'dumps', TypeError,
- 'loads', ValueError))
+ 'loads', ValueError, 'load'))
anyjson.force_implementation(__name__)