2
0

topic_comment_delete.py 999 B

12345678910111213141516171819202122232425262728
  1. from .tool.func import *
  2. async def topic_comment_delete(topic_num = 1, num = 1):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. if await acl_check(tool = 'owner_auth') == 1:
  6. return await re_error(conn, 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. return redirect(conn, '/thread/' + topic_num)
  12. else:
  13. return await render_template(
  14. await get_lang('topic_delete'),
  15. '''
  16. <hr class="main_hr">
  17. <form method="post">
  18. <button type="submit">''' + await get_lang('start') + '''</button>
  19. </form>
  20. ''',
  21. '(#' + num + ')',
  22. [['thread/' + topic_num + '/comment/' + num + '/tool', await get_lang('return')]]
  23. )