recent_history_delete.py 1.2 KB

1234567891011121314151617181920212223242526272829
  1. from .tool.func import *
  2. def recent_history_delete(name = 'Test', rev = 1):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. num = str(rev)
  6. if admin_check(conn) != 1:
  7. return re_error(conn, '/error/3')
  8. if flask.request.method == 'POST':
  9. admin_check(conn, None, 'history delete ' + name + ' r' + num)
  10. curs.execute(db_change("delete from history where id = ? and title = ?"), [num, name])
  11. return redirect(conn, '/history/' + url_pas(name))
  12. else:
  13. return easy_minify(conn, flask.render_template(skin_check(conn),
  14. imp = [name, wiki_set(conn), wiki_custom(conn), wiki_css(['(' + get_lang(conn, 'history_delete') + ') (r' + num + ')', 0])],
  15. data = '''
  16. <form method="post">
  17. <span>''' + get_lang(conn, 'delete_warning') + '''</span>
  18. <hr class="main_hr">
  19. <button type="submit">''' + get_lang(conn, 'delete') + '''</button>
  20. </form>
  21. ''',
  22. menu = [['history/' + url_pas(name), get_lang(conn, 'return')]]
  23. ))