Example #1
0
def _update_config():
    data = request.args.to_dict()
    for k, v in data.iteritems():
        if v.lower() == 'true':
            data[k]=True
        elif v.lower() == 'false':
            data[k]=False
        elif re.match(r'[0-9]+', v):
            data[k]=int(v)
        elif re.match(r'[0-9]+\.[0-9]+', v):
            data[k]=float(v)
        else:
            data[k]=str(v)
    ret, response = update_config(**data)
    return Response(json_encode({'ret': ret, 'response': response}),
                    mimetype="application/json")
Example #2
0
def _update_config():
    data = request.args.to_dict()
    for k, v in data.iteritems():
        if v.lower() == 'true':
            data[k]=True
        elif v.lower() == 'false':
            data[k]=False
        elif re.match(r'[0-9]+', v):
            data[k]=int(v)
        elif re.match(r'[0-9]+\.[0-9]+', v):
            data[k]=float(v)
        else:
            data[k]=str(v)
    ret, response = update_config(**data)
    return Response(json_encode({'ret': ret, 'response': response}),
                    mimetype="application/json")