functional-cloudysky 5 лет назад
Родитель
Сommit
2b1f5ff07d
1 измененных файлов с 6 добавлено и 2 удалено
  1. 6 2
      route/api_raw.py

+ 6 - 2
route/api_raw.py

@@ -4,11 +4,15 @@ def api_raw_2(conn, name):
     curs = conn.cursor()
 
     if acl_check(name, 'render') != 1:
-        curs.execute(db_change("select data from data where title = ?"), [name])
+        rev = flask.request.args.get('num', '')
+        if rev != '':
+            curs.execute(db_change("select data from history where title = ? and id = ?"), [name, rev])
+        else:
+            curs.execute(db_change("select data from data where title = ?"), [name])
         data = curs.fetchall()
         if data:
             json_data = { "title" : name, "data" : render_set(title = name, data = data[0][0], s_data = 1) }
 
             return flask.jsonify(json_data)
         
-    return flask.jsonify({})
+    return flask.jsonify({})