@api_bp.route('/all')
def all_storage():
    'Get all storage in JSON.'
    trees = current_app.trees
    mounts = MountTree()
    for (prefix, tree) in six.iteritems(trees):
        for (path, storage) in tree.iter_storage():
            mounts.mount(((prefix + '/') + path), storage)

    def dfs(node):
        children = node.children
        if children:
            ret = []
            for name in sorted(six.iterkeys(children)):
                child = children[name]
                child_ret = dfs(child)
                if child_ret:
                    ret.append((name, child_ret))
            if ret:
                return ret
        data = node.data
        if data:
            return data.to_dict()
    return jsonify((dfs(mounts.root) or []))
Get all storage in JSON.
@api_bp.route('/all')
def all_storage():
    
    trees = current_app.trees
    mounts = MountTree()
    for (prefix, tree) in six.iteritems(trees):
        for (path, storage) in tree.iter_storage():
            mounts.mount(((prefix + '/') + path), storage)

    def dfs(node):
        children = node.children
        if children:
            ret = []
            for name in sorted(six.iterkeys(children)):
                child = children[name]
                child_ret = dfs(child)
                if child_ret:
                    ret.append((name, child_ret))
            if ret:
                return ret
        data = node.data
        if data:
            return data.to_dict()
    return jsonify((dfs(mounts.root) or []))