예제 #1
0
파일: util_tests.py 프로젝트: virtusize/nap
def test_json():
    s = '[0, true, "False"]'
    compare(s, encode_json([0, True, 'False']))
    compare(s, encode_json(decode_json(s)))

    d = {'one': 0, 'two': True, 'three': 'False'}
    s = '{"three": "False", "two": true, "one": 0}'
    compare(s, encode_json(d))
    compare(d, decode_json(encode_json(d)))
예제 #2
0
파일: helpers.py 프로젝트: virtusize/nap
def with_json_data(dct):
    return dict(data=encode_json(dct), content_type='application/json')
예제 #3
0
파일: api.py 프로젝트: virtusize/nap
 def make_response(self, data, status_code):
     json_data = encode_json(data)
     response = make_response(json_data)
     response.status_code = status_code
     response.mimetype = 'application/json'
     return response
예제 #4
0
파일: nap_client.py 프로젝트: virtusize/nap
 def _serialize(self, data):
     return encode_json(self.output_filter.filter(data))
예제 #5
0
파일: model.py 프로젝트: virtusize/nap
 def process_bind_param(self, value, dialect):
     if value is not None:
         value = encode_json(self.serializer.serialize(value))
     return value