Merge pull request #425 from JackDandy/feature/UpdateJsonrpclib

Update jsonrpclib library r20 to (b59217c).
This commit is contained in:
JackDandy 2015-06-16 17:37:46 +01:00
commit df6975833f
5 changed files with 29 additions and 17 deletions

View file

@ -48,6 +48,7 @@
* Update dateutil library 2.2 to 2.4.2 (a6b8925) * Update dateutil library 2.2 to 2.4.2 (a6b8925)
* Update ConfigObj library 4.6.0 to 5.1.0 (a68530a) * Update ConfigObj library 4.6.0 to 5.1.0 (a68530a)
* Update Beautiful Soup to 4.3.2 (r353) * Update Beautiful Soup to 4.3.2 (r353)
* Update jsonrpclib library r20 to (b59217c)
[develop changelog] [develop changelog]
* Update Requests library 2.7.0 (ab1f493) to 2.7.0 (8b5e457) * Update Requests library 2.7.0 (ab1f493) to 2.7.0 (8b5e457)

View file

@ -1,6 +1,6 @@
import lib.jsonrpclib import jsonrpclib
from lib.jsonrpclib import Fault from jsonrpclib import Fault
from lib.jsonrpclib.jsonrpc import USE_UNIX_SOCKETS from jsonrpclib.jsonrpc import USE_UNIX_SOCKETS
import SimpleXMLRPCServer import SimpleXMLRPCServer
import SocketServer import SocketServer
import socket import socket

View file

@ -1,7 +1,6 @@
from config import Config from jsonrpclib.config import Config
config = Config.instance() config = Config.instance()
from history import History from jsonrpclib.history import History
history = History.instance() history = History.instance()
import jsonrpc from jsonrpclib.jsonrpc import Server, MultiCall, Fault
from jsonrpc import Server, MultiCall, Fault from jsonrpclib.jsonrpc import ProtocolError, loads, dumps
from jsonrpc import ProtocolError, loads, dumps

View file

@ -3,7 +3,7 @@ import inspect
import re import re
import traceback import traceback
from lib.jsonrpclib import config from jsonrpclib import config
iter_types = [ iter_types = [
types.DictType, types.DictType,
@ -129,6 +129,13 @@ def load(obj):
except ImportError: except ImportError:
raise TranslationError('Could not import %s from module %s.' % raise TranslationError('Could not import %s from module %s.' %
(json_class_name, json_module_tree)) (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) json_class = getattr(temp_module, json_class_name)
# Creating the object... # Creating the object...
new_obj = None new_obj = None

View file

@ -57,9 +57,9 @@ import string
import random import random
# Library includes # Library includes
import lib.jsonrpclib import jsonrpclib
from lib.jsonrpclib import config from jsonrpclib import config
from lib.jsonrpclib import history from jsonrpclib import history
# JSON library importing # JSON library importing
cjson = None cjson = None
@ -71,7 +71,7 @@ except ImportError:
import json import json
except ImportError: except ImportError:
try: try:
import lib.simplejson as json import simplejson as json
except ImportError: except ImportError:
raise ImportError( raise ImportError(
'You must have the cjson, json, or simplejson ' + 'You must have the cjson, json, or simplejson ' +
@ -148,10 +148,15 @@ class JSONTarget(object):
return ''.join(self.data) return ''.join(self.data)
class Transport(TransportMixIn, XMLTransport): class Transport(TransportMixIn, XMLTransport):
pass def __init__(self):
TransportMixIn.__init__(self)
XMLTransport.__init__(self)
class SafeTransport(TransportMixIn, XMLSafeTransport): class SafeTransport(TransportMixIn, XMLSafeTransport):
pass def __init__(self):
TransportMixIn.__init__(self)
XMLSafeTransport.__init__(self)
from httplib import HTTP, HTTPConnection from httplib import HTTP, HTTPConnection
from socket import socket 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 '+ raise ValueError('Method name must be a string, or methodresponse '+
'must be set to True.') 'must be set to True.')
if config.use_jsonclass == True: if config.use_jsonclass == True:
from lib.jsonrpclib import jsonclass from jsonrpclib import jsonclass
params = jsonclass.dump(params) params = jsonclass.dump(params)
if methodresponse is True: if methodresponse is True:
if rpcid is None: if rpcid is None:
@ -509,7 +514,7 @@ def loads(data):
# should return something like the following: # should return something like the following:
# { 'jsonrpc':'2.0', 'error': fault.error(), id: None } # { 'jsonrpc':'2.0', 'error': fault.error(), id: None }
if config.use_jsonclass == True: if config.use_jsonclass == True:
from lib.jsonrpclib import jsonclass from jsonrpclib import jsonclass
result = jsonclass.load(result) result = jsonclass.load(result)
return result return result