From 4c9d439ef24f5afdd74aa9153aa8fc772051e6cb Mon Sep 17 00:00:00 2001 From: Tim Daly Jr Date: Tue, 26 Jun 2012 02:48:42 +0000 Subject: 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 --- openstack/common/jsonutils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'openstack') 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__) -- cgit