Пример #1
0
def v0_get_tree(tree):
    """
    Get the status of a single tree in a format compatible with the old
    treestatus
    """
    tree = api.get_data(get_tree, tree)
    resp = flask.Response(api.dumps(types.JsonTree, tree))
    resp.headers['content-type'] = 'application/json'
    return resp
Пример #2
0
def v0_get_trees():
    """
    Get the status of all trees in a format compatible with the old
    treestatus
    """
    trees = api.get_data(get_trees)
    resp = flask.Response(api.dumps({unicode: types.JsonTree}, trees))
    resp.headers['content-type'] = 'application/json'
    return resp
Пример #3
0
def tree_cache_set(tree, data):
    with _get_mc() as mc:
        if not mc:
            return None
        j = api.dumps(types.JsonTree, data)
        mc.set(tree.encode('utf-8'), j.encode('utf-8'))
def test_dumps():
    thing = TestType(name="n", value=3)
    eq_(json.loads(api.dumps(TestType, thing)), dict(name=u"n", value=3))
Пример #5
0
def test_dumps():
    thing = TestType(name="n", value=3)
    eq_(json.loads(api.dumps(TestType, thing)), dict(name=u"n", value=3))