コード例 #1
0
def use_config():
    #print "reach use_config"
    #print request.args
    res_file_path = UPLOAD_FOLDER + '/' + request.args.get('res_file')
    property_file_path = UPLOAD_FOLDER + '/' + request.args.get(
        'property_file')
    goal_file_path = UPLOAD_FOLDER + '/' + request.args.get('goal_file')
    software_file_path = UPLOAD_FOLDER + '/' + request.args.get(
        'software_file')

    res_list = Xutils.get_res_list_from_environment_json(res_file_path)
    for res in res_list:
        print res
        client.add_res(*res)
        all_res.append(res[0])
        #show_environment.append({"label": res[0].encode()})
    print client.get_all_res_value(all_res, -1)

    property_list = Xutils.get_res_list_from_property_json(property_file_path)
    for res in property_list:
        client.add_res(*res)
        all_property.append(res[0])
        #show_property.append({"label": res[0].encode()})

    with open(goal_file_path, "r") as fin:
        goal_context = fin.read()
        client.add_res("room:goal_model", {"initial": goal_context}, None)
        goal_data = json.load(open(goal_file_path))
        get_goal_list(goal_data)
        show_goal = get_show_goal(goal_data)

    with open(software_file_path, "r") as fin:
        context = fin.read()
        client.add_res("room:software_model", {"initial": context}, None)
        software_data = json.load(
            open(software_file_path))["software"]["feature"]
        # add
        # print software_data
        show_software = get_show_software(software_data)
        get_software_list(show_software)
    return "ok"
コード例 #2
0
ファイル: self.py プロジェクト: Thinginitself/self-web
def op_add_property_from_file():
    file = request.files['property_file']
    if file and allowed_file(file.filename):
        filename = secure_filename(file.filename)
        filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
        file.save(filepath)
        property_list = Xutils.get_res_list_from_property_json(filepath)
        for res in property_list:
            client.add_res(*res)
            all_res.append(res[0])
            show_property.append({"label": res[0].encode()})
    return redirect(url_for('view_environment_list'))
コード例 #3
0
def op_add_res_from_file():
    file = request.files['res_file']
    if file and allowed_file(file.filename):
        filename = secure_filename(file.filename)
        filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename)
        file.save(filepath)
        global file_path
        file_path['res_file'] = filepath
        res_list = Xutils.get_res_list_from_environment_json(filepath)
        for res in res_list:
            print res
            client.add_res(*res)
            all_res.append(res[0])
            show_environment.append({"label": res[0].encode()})
        print client.get_all_res_value(all_res, -1)
    return redirect(url_for('view_environment_list'))