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 /jsonrpclib | |
parent | 2925702c5bfdb07debddfd43144f06cbd49aca67 (diff) | |
download | jsonrpclib-3789355028206a63b2d161a9c47c5e2d0b212b32.tar.gz |
method name now checked against string and unicode for python 2.7
Diffstat (limited to 'jsonrpclib')
-rw-r--r-- | jsonrpclib/SimpleJSONRPCServer.py | 7 |
1 files changed, 5 insertions, 2 deletions
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 |