2
0

topic_comment_blind.py 988 B

1234567891011121314151617181920212223242526
  1. from .tool.func import *
  2. async def topic_comment_blind(topic_num = 1, num = 1):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. topic_num = str(topic_num)
  6. num = str(num)
  7. if await acl_check(tool = 'toron_auth', memo = 'blind (code ' + topic_num + '#' + num + ')') == 1:
  8. return await re_error(conn, 3)
  9. curs.execute(db_change("select block from topic where code = ? and id = ?"), [topic_num, num])
  10. block = curs.fetchall()
  11. if block:
  12. if block[0][0] == 'O':
  13. curs.execute(db_change("update topic set block = '' where code = ? and id = ?"), [topic_num, num])
  14. else:
  15. curs.execute(db_change("update topic set block = 'O' where code = ? and id = ?"), [topic_num, num])
  16. do_reload_recent_thread(conn,
  17. topic_num,
  18. get_time()
  19. )
  20. return redirect(conn, '/thread/' + topic_num + '#' + num)