diff options
author | Paul Smith <prs247au@gmail.com> | 2017-05-14 13:08:44 +1000 |
---|---|---|
committer | Paul Smith <prs247au@gmail.com> | 2017-05-14 13:08:44 +1000 |
commit | 3789355028206a63b2d161a9c47c5e2d0b212b32 (patch) | |
tree | 57263566e65adafc3d37cd499ea3f01901a5d37b | |
parent | 2925702c5bfdb07debddfd43144f06cbd49aca67 (diff) | |
download | jsonrpclib-3789355028206a63b2d161a9c47c5e2d0b212b32.tar.gz |
method name now checked against string and unicode for python 2.7
-rw-r--r-- | dev-requirements.txt | 14 | ||||
-rw-r--r-- | jsonrpclib/SimpleJSONRPCServer.py | 7 |
2 files changed, 12 insertions, 9 deletions
diff --git a/dev-requirements.txt b/dev-requirements.txt index 95cb849..c1c28fa 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,11 +1,11 @@ -coverage==4.0 +coverage==4.4 linecache2==1.0.0 nose==1.3.7 -pluggy==0.3.1 -py==1.4.30 -six==1.9.0 -tox==2.1.1 +pluggy==0.4.0 +py==1.4.33 +six==1.10.0 +tox==2.7.0 traceback2==1.4.0 unittest2==1.1.0 -virtualenv==13.1.2 -wheel==0.24.0 +virtualenv==15.1.0 +wheel==0.29.0 diff --git a/jsonrpclib/SimpleJSONRPCServer.py b/jsonrpclib/SimpleJSONRPCServer.py index 221d0c8..cf48a66 100644 --- a/jsonrpclib/SimpleJSONRPCServer.py +++ b/jsonrpclib/SimpleJSONRPCServer.py @@ -10,7 +10,6 @@ except ImportError: import socket import logging import os -import types import traceback import sys try: @@ -18,6 +17,10 @@ try: except ImportError: # For Windows fcntl = None +try: + string_types = (str, unicode) +except NameError: + string_types = (str, ) def get_version(request): @@ -43,7 +46,7 @@ def validate_request(request): request.setdefault('params', []) method = request.get('method', None) params = request.get('params') - if not method or not isinstance(method, str) or \ + if not method or not isinstance(method, string_types) or \ not isinstance(params, (list, dict, tuple)): fault = Fault( -32600, 'Invalid request parameters or method.', rpcid=rpcid |