コード例 #1
0
def add_premise_to_argument(request):
    db_user: User = request.validated['user']
    db_issue: Issue = request.validated['issue']
    db_argument: Argument = request.validated['argument']
    relation: Relations = request.validated['relation']
    history = history_handler.handle_history(request, db_user, db_issue)

    pd = set_arguments_premises(db_issue, db_user, db_argument,
                                [[request.validated['reason-text']]], relation,
                                history, request.mailer)

    return HTTPSeeOther(location='/api' + pd['url'])
コード例 #2
0
ファイル: json.py プロジェクト: project-renard-survey/dbas
def set_new_premises_for_argument(request):
    """
    Sets a new premise for an argument

    :param request: request of the web server
    :return: json-dict()
    """
    LOG.debug("Set new premise for an argument. %s", request.json_body)
    prepared_dict = set_arguments_premises(
        request.validated['issue'], request.validated['user'],
        request.validated['argument'], request.validated['premisegroups'],
        relation_mapper[request.validated['attack_type']],
        request.cookies['_HISTORY_']
        if '_HISTORY_' in request.cookies else None, request.mailer)
    __modifiy_discussion_url(prepared_dict)
    return prepared_dict
コード例 #3
0
def add_premise_to_argument(request):
    db_user: User = request.validated['user']
    db_issue: Issue = request.validated['issue']
    db_argument: Argument = request.validated['argument']
    reference_text: str = request.validated['reference']
    relation: Relations = request.validated['relation']
    origin: DataOrigin = request.validated['origin']
    history = history_handler.save_and_set_cookie(request, db_user, db_issue)
    host, path = split_url(request.environ.get("HTTP_REFERER"))

    if reference_text:
        for premise in db_argument.premisegroup.premises:
            store_reference(reference_text, host, path, db_user, premise.statement, db_issue)

    pd = set_arguments_premises(db_issue, db_user, db_argument, [[request.validated['reason-text']]], relation,
                                history, request.mailer)

    __store_origin_and_reference(db_issue, db_user, origin, host, path, reference_text, pd['statement_uids'])

    return __http_see_other_with_cors_header('/api' + pd['url'])