flask_boost/project/application/utils/decorators.py
def jsonify(func):
    """JSON decorator."""

    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        r = func(*args, **kwargs)
        if isinstance(r, tuple):
            code, data = r
        else:
            code, data = 200, r
        return Response(json.dumps(data), status=code, mimetype='application/json')

    return wrapper
def jsonify(func):
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        r = func(*args, **kwargs)
        if isinstance(r, tuple):
            code, data = r
        else:
            code, data = 200, r
        return Response(json.dumps(data), status=code, mimetype='application/json')

    return wrapper
def jsonify ( func ) : @ functools . wraps ( func ) def wrapper ( * args , * * kwargs ) : r = func ( * args , * * kwargs ) if isinstance ( r , tuple ) : code , data = r else : code , data = 200 , r return Response ( json . dumps ( data ) , status = code , mimetype = 'application/json' ) return wrapper
JSON decorator.
JSON decorator .