|
@@ -3,28 +3,42 @@ from .tool.func import *
|
|
|
def api_w_2(conn, name):
|
|
def api_w_2(conn, name):
|
|
|
curs = conn.cursor()
|
|
curs = conn.cursor()
|
|
|
|
|
|
|
|
- if flask.request.args.get('exist', None):
|
|
|
|
|
|
|
+ data_arg_exist = flask.request.args.get('exist', '')
|
|
|
|
|
+ if data_arg_exist != '':
|
|
|
curs.execute(db_change("select title from data where title = ?"), [name])
|
|
curs.execute(db_change("select title from data where title = ?"), [name])
|
|
|
if curs.fetchall():
|
|
if curs.fetchall():
|
|
|
return flask.jsonify({ "exist" : "1" })
|
|
return flask.jsonify({ "exist" : "1" })
|
|
|
else:
|
|
else:
|
|
|
if acl_check(name, 'render') != 1:
|
|
if acl_check(name, 'render') != 1:
|
|
|
if flask.request.method == 'POST':
|
|
if flask.request.method == 'POST':
|
|
|
- g_data = flask.request.form.get('data', '')
|
|
|
|
|
- g_data = render_set(title = name, data = g_data, num = 2)
|
|
|
|
|
|
|
+ data_org = flask.request.form.get('data', '')
|
|
|
|
|
+ data_pas = render_set(
|
|
|
|
|
+ title = name,
|
|
|
|
|
+ data = data_org,
|
|
|
|
|
+ num = 2
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
- return flask.jsonify({ "title" : name, "data" : g_data[0], "js_data" : g_data[1] })
|
|
|
|
|
|
|
+ return flask.jsonify({
|
|
|
|
|
+ "data" : data_pas[0],
|
|
|
|
|
+ "js_data" : data_pas[1]
|
|
|
|
|
+ })
|
|
|
else:
|
|
else:
|
|
|
- rev = flask.request.args.get('num', '')
|
|
|
|
|
- if rev != '':
|
|
|
|
|
|
|
+ data_arg_rev = flask.request.args.get('num', '')
|
|
|
|
|
+ if data_arg_rev != '':
|
|
|
curs.execute(db_change("select data from history where title = ? and id = ?"), [name, rev])
|
|
curs.execute(db_change("select data from history where title = ? and id = ?"), [name, rev])
|
|
|
else:
|
|
else:
|
|
|
curs.execute(db_change("select data from data where title = ?"), [name])
|
|
curs.execute(db_change("select data from data where title = ?"), [name])
|
|
|
|
|
+
|
|
|
data = curs.fetchall()
|
|
data = curs.fetchall()
|
|
|
if data:
|
|
if data:
|
|
|
|
|
+ name_org = flask.request.args.get('name_org', '')
|
|
|
|
|
+ if name_org == '':
|
|
|
|
|
+ name_org = name
|
|
|
|
|
+
|
|
|
json_data = data[0][0]
|
|
json_data = data[0][0]
|
|
|
- include_data = flask.request.args.get('include', None)
|
|
|
|
|
- if include_data:
|
|
|
|
|
|
|
+
|
|
|
|
|
+ include_data = flask.request.args.get('include', '')
|
|
|
|
|
+ if include_data != '':
|
|
|
get_all_change_1 = []
|
|
get_all_change_1 = []
|
|
|
find_replace_moment = re.findall(r'(@([^=@]+)=([^=@]+)@|@([^=@]+)@)', json_data)
|
|
find_replace_moment = re.findall(r'(@([^=@]+)=([^=@]+)@|@([^=@]+)@)', json_data)
|
|
|
for i in find_replace_moment:
|
|
for i in find_replace_moment:
|
|
@@ -43,8 +57,16 @@ def api_w_2(conn, name):
|
|
|
1
|
|
1
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
- g_data = render_set(title = name, data = json_data, num = 2, include = include_data)
|
|
|
|
|
|
|
+ data_pas = render_set(
|
|
|
|
|
+ title = name_org,
|
|
|
|
|
+ data = json_data,
|
|
|
|
|
+ num = 2,
|
|
|
|
|
+ include = include_data
|
|
|
|
|
+ )
|
|
|
|
|
|
|
|
- return flask.jsonify({ "title" : name, "data" : g_data[0], "js_data" : g_data[1] })
|
|
|
|
|
|
|
+ return flask.jsonify({
|
|
|
|
|
+ "data" : data_pas[0],
|
|
|
|
|
+ "js_data" : data_pas[1]
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
return flask.jsonify({})
|
|
return flask.jsonify({})
|