list_long_page.py 1.2 KB

12345678910111213141516171819202122232425262728
  1. from .tool.func import *
  2. def list_long_page(tool = 'long_page', arg_num = 1):
  3. with get_db_connect() as conn:
  4. curs = conn.cursor()
  5. sql_num = (arg_num * 50 - 50) if arg_num * 50 > 0 else 0
  6. curs.execute(db_change('select data from other where name = "count_all_title"'))
  7. if int(curs.fetchall()[0][0]) > 30000:
  8. return re_error('/error/25')
  9. div = '<ul class="opennamu_ul">'
  10. select_data = 'desc' if tool == 'long_page' else 'asc'
  11. title = 'long_page' if tool == 'long_page' else 'short_page'
  12. curs.execute(db_change("select title, length(data) from data order by length(data) " + select_data + " limit ?, 50"), [sql_num])
  13. db_data = curs.fetchall()
  14. for data in db_data:
  15. div += '<li>' + str(data[1]) + ' | <a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a></li>'
  16. div += '</ul>' + next_fix('/list/document/' + ('long' if title == 'long_page' else 'short') + '/', arg_num, db_data)
  17. return easy_minify(flask.render_template(skin_check(),
  18. imp = [load_lang(title), wiki_set(), wiki_custom(), wiki_css([0, 0])],
  19. data = div,
  20. menu = [['other', load_lang('return')]]
  21. ))