func_title_random.py 436 B

123456789101112131415
  1. from .tool.func import *
  2. def func_title_random_2(conn):
  3. curs = conn.cursor()
  4. curs.execute(db_change("" + \
  5. "select title from data " + \
  6. "where title not like 'user:%' and title not like 'category:%' and title not like 'file:%'" + \
  7. "order by random() limit 1" + \
  8. ""))
  9. data = curs.fetchall()
  10. if data:
  11. return redirect('/w/' + url_pas(data[0][0]))
  12. else:
  13. return redirect()