2
0

api_raw.py 631 B

123456789101112131415161718
  1. from .tool.func import *
  2. def api_raw_2(conn, name):
  3. curs = conn.cursor()
  4. if acl_check(name, 'render') != 1:
  5. rev = flask.request.args.get('num', '')
  6. if rev != '':
  7. curs.execute(db_change("select data from history where title = ? and id = ?"), [name, rev])
  8. else:
  9. curs.execute(db_change("select data from data where title = ?"), [name])
  10. data = curs.fetchall()
  11. if data:
  12. json_data = { "title" : name, "data" : render_set(title = name, data = data[0][0], s_data = 1) }
  13. return flask.jsonify(json_data)
  14. return flask.jsonify({})