list_old_page.py 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. from .tool.func import *
  2. def list_old_page_2(conn):
  3. curs = conn.cursor()
  4. num = int(number_check(flask.request.args.get('num', '1')))
  5. if num * 50 > 0:
  6. sql_num = num * 50 - 50
  7. else:
  8. sql_num = 0
  9. div = '<ul>'
  10. curs.execute(db_change('' + \
  11. 'select title, date from history h ' + \
  12. "where title not like 'user:%' and title not like 'category:%' and title not like 'file:%' and " + \
  13. "exists (select title from data where title = h.title) " + \
  14. "and not exists (select title from back where link = h.title and type = 'redirect') " + \
  15. 'group by title ' + \
  16. 'order by date asc ' + \
  17. 'limit ?, 50' + \
  18. ''), [sql_num])
  19. n_list = curs.fetchall()
  20. for data in n_list:
  21. div += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a> (' + re.sub(' .*$', '', data[1]) + ')</li>'
  22. div += '</ul>' + next_fix('/old_page?num=', num, n_list)
  23. return easy_minify(flask.render_template(skin_check(),
  24. imp = [load_lang('old_page'), wiki_set(), custom(), other2([0, 0])],
  25. data = div,
  26. menu = [['other', load_lang('return')]]
  27. ))