topic_comment_delete.py 1.1 KB

12345678910111213141516171819202122232425262728
  1. from .tool.func import *
  2. def topic_comment_delete(topic_num = 1, num = 1):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. if admin_check(conn, None) != 1:
  6. return re_error(conn, '/error/3')
  7. topic_num = str(topic_num)
  8. num = str(num)
  9. if flask.request.method == 'POST':
  10. curs.execute(db_change("delete from topic where code = ? and id = ?"), [topic_num, num])
  11. conn.commit()
  12. return redirect(conn, '/thread/' + topic_num)
  13. else:
  14. return easy_minify(conn, flask.render_template(skin_check(conn),
  15. imp = [get_lang(conn, 'topic_delete'), wiki_set(conn), wiki_custom(conn), wiki_css(['(#' + num + ')', 0])],
  16. data = '''
  17. <hr class="main_hr">
  18. <form method="post">
  19. <button type="submit">''' + get_lang(conn, 'start') + '''</button>
  20. </form>
  21. ''',
  22. menu = [['thread/' + topic_num + '/comment/' + num + '/tool', get_lang(conn, 'return')]]
  23. ))