Explorar el Código

리비젼 매개변수

functional-cloudysky hace 5 años
padre
commit
0432192441
Se han modificado 1 ficheros con 6 adiciones y 2 borrados
  1. 6 2
      route/api_w.py

+ 6 - 2
route/api_w.py

@@ -15,7 +15,11 @@ def api_w_2(conn, name):
 
                 return flask.jsonify({ "title" : name, "data" : g_data[0], "js_data" : g_data[1] })
             else:
-                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 = data[0][0]
@@ -43,4 +47,4 @@ def api_w_2(conn, name):
 
                     return flask.jsonify({ "title" : name, "data" : g_data[0], "js_data" : g_data[1] })
 
-    return flask.jsonify({})
+    return flask.jsonify({})