Ejemplo n.º 1
0
 def procedure_desc(self, key):
     M = self.urls[key]
     return {
         'name': M.json_method,
         'summary': M.__doc__,
         'idempotent': M.json_safe,
         'params': [{'type': text_type(Any.kind(t)), 'name': k}
             for k, t in iteritems(M.json_arg_types)],
         'return': {'type': text_type(Any.kind(M.json_return_type))}}
Ejemplo n.º 2
0
def encode_kw11(p):
    if not type(p) is dict:
        return {}
    ret = p.copy()
    removes = []
    for k, v in iteritems(ret):
        try:
            int(k)
        except ValueError:
            pass
        else:
            removes.append(k)
    for k in removes:
        ret.pop(k)
    return ret
Ejemplo n.º 3
0
def encode_kw11(p):
    if not type(p) is dict:
        return {}
    ret = p.copy()
    removes = []
    for k, v in iteritems(ret):
        try:
            int(k)
        except ValueError:
            pass
        else:
            removes.append(k)
    for k in removes:
        ret.pop(k)
    return ret
Ejemplo n.º 4
0
def encode_arg11(p):
    if type(p) is list:
        return p
    elif not type(p) is dict:
        return []
    else:
        pos = []
        d = encode_kw(p)
        for k, v in iteritems(d):
            try:
                pos.append(int(k))
            except ValueError:
                pass
        pos = list(set(pos))
        pos.sort()
        return [d[text_type(i)] for i in pos]
Ejemplo n.º 5
0
def encode_arg11(p):
    if type(p) is list:
        return p
    elif not type(p) is dict:
        return []
    else:
        pos = []
        d = encode_kw(p)
        for k, v in iteritems(d):
            try:
                pos.append(int(k))
            except ValueError:
                pass
        pos = list(set(pos))
        pos.sort()
        return [d[text_type(i)] for i in pos]
Ejemplo n.º 6
0
from flask_jsonrpc.exceptions import (Error, ParseError, InvalidRequestError,
                                      MethodNotFoundError, InvalidParamsError,
                                      ServerError, RequestPostError,
                                      InvalidCredentialsError, OtherError)

JSONRPC_VERSION_DEFAULT = '2.0'

empty_dec = lambda f: f
try:
    # TODO: Add CSRF check
    csrf_exempt = empty_dec
except (NameError, ImportError):
    csrf_exempt = empty_dec

NoneType = type(None)
encode_kw = lambda p: dict([(text_type(k), v) for k, v in iteritems(p)])


def encode_kw11(p):
    if not type(p) is dict:
        return {}
    ret = p.copy()
    removes = []
    for k, v in iteritems(ret):
        try:
            int(k)
        except ValueError:
            pass
        else:
            removes.append(k)
    for k in removes:
Ejemplo n.º 7
0
from flask_jsonrpc.exceptions import (Error, ParseError, InvalidRequestError,
                                      MethodNotFoundError, InvalidParamsError,
                                      ServerError, RequestPostError,
                                      InvalidCredentialsError, OtherError)

JSONRPC_VERSION_DEFAULT = '2.0'

empty_dec = lambda f: f
try:
    # TODO: Add CSRF check
    csrf_exempt = empty_dec
except (NameError, ImportError):
    csrf_exempt = empty_dec

NoneType = type(None)
encode_kw = lambda p: dict([(text_type(k), v) for k, v in iteritems(p)])

def encode_kw11(p):
    if not type(p) is dict:
        return {}
    ret = p.copy()
    removes = []
    for k, v in iteritems(ret):
        try:
            int(k)
        except ValueError:
            pass
        else:
            removes.append(k)
    for k in removes:
        ret.pop(k)
Ejemplo n.º 8
0
from flask_jsonrpc._compat import (text_type, string_types, integer_types,
                                   iteritems, iterkeys)
from flask_jsonrpc.exceptions import (Error, ParseError, InvalidRequestError, 
                                      MethodNotFoundError, InvalidParamsError, 
                                      ServerError, RequestPostError,
                                      InvalidCredentialsError, OtherError)

empty_dec = lambda f: f
try:
    # TODO: Add CSRF check
    csrf_exempt = empty_dec
except (NameError, ImportError):
    csrf_exempt = empty_dec

NoneType = type(None)
encode_kw = lambda p: dict([(str(k), v) for k, v in iteritems(p)])

def encode_kw11(p):
    if not type(p) is dict:
        return {}
    ret = p.copy()
    removes = []
    for k, v in iteritems(ret):
        try:
            int(k)
        except ValueError:
            pass
        else:
            removes.append(k)
    for k in removes:
        ret.pop(k)