Exemple #1
0
def store_derivate(path, arg_text, arg_type, derivate_wiki_text, author):
    new_node, new_path = store_structure_node(path, derivate_wiki_text, author)
    node = get_node_for_path(path)
    arg_title, arg_text = backend.split_title_from_text(arg_text)
    arg = node.add_derivate(new_node, arg_type=arg_type,
                            title=arg_title,
                            text=arg_text, authors=[author])
    # add auto follow
    create_vote(author, [arg])
    return new_path
Exemple #2
0
def store_argument(path, arg_text, arg_type, author):
    node = get_node_for_path(path)
    title, arg_text = backend.split_title_from_text(arg_text)
    original_argument = create_argument(node, arg_type, title, arg_text,
                                        [author])
    # add auto follow
    create_vote(author, [original_argument])
    # copy argument for all derivates
    for d in node.traverse_derivates():
        new_argument = create_argument(d, arg_type, title, arg_text, [author])
        original_argument.add_derivate(new_argument)
    return path + "." + arg_type + "." + str(node.arguments.count())
Exemple #3
0
def store_derivate(path, arg_text, arg_type, derivate_wiki_text, author):
    node = get_node_for_path(path)
    arg_title, arg_text = backend.split_title_from_text(arg_text)

    slot_path = path.rsplit('.', 1)[0]
    slot = get_node_for_path(slot_path)
    structure_schema = backend.parse(derivate_wiki_text, None)

    score_tree = build_score_tree(node, structure_schema)

    new_node, path_couples = backend.create_derivate_from_structure_node_schema(
        structure_schema, slot, author,  node, score_tree, arg_type, arg_title,
        arg_text)

    new_path = get_good_path_for_structure_node(new_node, slot, slot_path)
    return new_path, path_couples