diff --git a/CHANGES.md b/CHANGES.md index ca8ad0c9..7c815e0e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -48,6 +48,7 @@ * Update dateutil library 2.2 to 2.4.2 (a6b8925) * Update ConfigObj library 4.6.0 to 5.1.0 (a68530a) * Update Beautiful Soup to 4.3.2 (r353) +* Update jsonrpclib library r20 to (b59217c) [develop changelog] * Update Requests library 2.7.0 (ab1f493) to 2.7.0 (8b5e457) diff --git a/lib/jsonrpclib/SimpleJSONRPCServer.py b/lib/jsonrpclib/SimpleJSONRPCServer.py index e4b20afc..d76da73e 100644 --- a/lib/jsonrpclib/SimpleJSONRPCServer.py +++ b/lib/jsonrpclib/SimpleJSONRPCServer.py @@ -1,6 +1,6 @@ -import lib.jsonrpclib -from lib.jsonrpclib import Fault -from lib.jsonrpclib.jsonrpc import USE_UNIX_SOCKETS +import jsonrpclib +from jsonrpclib import Fault +from jsonrpclib.jsonrpc import USE_UNIX_SOCKETS import SimpleXMLRPCServer import SocketServer import socket diff --git a/lib/jsonrpclib/__init__.py b/lib/jsonrpclib/__init__.py index 92c29b39..6e884b83 100644 --- a/lib/jsonrpclib/__init__.py +++ b/lib/jsonrpclib/__init__.py @@ -1,7 +1,6 @@ -from config import Config +from jsonrpclib.config import Config config = Config.instance() -from history import History +from jsonrpclib.history import History history = History.instance() -import jsonrpc -from jsonrpc import Server, MultiCall, Fault -from jsonrpc import ProtocolError, loads, dumps +from jsonrpclib.jsonrpc import Server, MultiCall, Fault +from jsonrpclib.jsonrpc import ProtocolError, loads, dumps diff --git a/lib/jsonrpclib/jsonclass.py b/lib/jsonrpclib/jsonclass.py index 519bdec7..1d86d5fc 100644 --- a/lib/jsonrpclib/jsonclass.py +++ b/lib/jsonrpclib/jsonclass.py @@ -3,7 +3,7 @@ import inspect import re import traceback -from lib.jsonrpclib import config +from jsonrpclib import config iter_types = [ types.DictType, @@ -129,6 +129,13 @@ def load(obj): except ImportError: raise TranslationError('Could not import %s from module %s.' % (json_class_name, json_module_tree)) + + # The returned class is the top-level module, not the one we really + # want. (E.g., if we import a.b.c, we now have a.) Walk through other + # path components to get to b and c. + for i in json_module_parts[1:]: + temp_module = getattr(temp_module, i) + json_class = getattr(temp_module, json_class_name) # Creating the object... new_obj = None diff --git a/lib/jsonrpclib/jsonrpc.py b/lib/jsonrpclib/jsonrpc.py index a4d4c33a..5bde5510 100644 --- a/lib/jsonrpclib/jsonrpc.py +++ b/lib/jsonrpclib/jsonrpc.py @@ -57,9 +57,9 @@ import string import random # Library includes -import lib.jsonrpclib -from lib.jsonrpclib import config -from lib.jsonrpclib import history +import jsonrpclib +from jsonrpclib import config +from jsonrpclib import history # JSON library importing cjson = None @@ -71,7 +71,7 @@ except ImportError: import json except ImportError: try: - import lib.simplejson as json + import simplejson as json except ImportError: raise ImportError( 'You must have the cjson, json, or simplejson ' + @@ -148,10 +148,15 @@ class JSONTarget(object): return ''.join(self.data) class Transport(TransportMixIn, XMLTransport): - pass + def __init__(self): + TransportMixIn.__init__(self) + XMLTransport.__init__(self) class SafeTransport(TransportMixIn, XMLSafeTransport): - pass + def __init__(self): + TransportMixIn.__init__(self) + XMLSafeTransport.__init__(self) + from httplib import HTTP, HTTPConnection from socket import socket @@ -481,7 +486,7 @@ def dumps(params=[], methodname=None, methodresponse=None, raise ValueError('Method name must be a string, or methodresponse '+ 'must be set to True.') if config.use_jsonclass == True: - from lib.jsonrpclib import jsonclass + from jsonrpclib import jsonclass params = jsonclass.dump(params) if methodresponse is True: if rpcid is None: @@ -509,7 +514,7 @@ def loads(data): # should return something like the following: # { 'jsonrpc':'2.0', 'error': fault.error(), id: None } if config.use_jsonclass == True: - from lib.jsonrpclib import jsonclass + from jsonrpclib import jsonclass result = jsonclass.load(result) return result