list_old_page.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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('' + \
  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. 'group by title ' + \
  15. 'order by date asc ' + \
  16. 'limit ?, "50"' + \
  17. '', [str(sql_num)])
  18. n_list = curs.fetchall()
  19. for data in n_list:
  20. div += '<li><a href="/w/' + url_pas(data[0]) + '">' + html.escape(data[0]) + '</a> (' + re.sub(' .*$', '', data[1]) + ')</li>'
  21. div += '</ul>' + next_fix('/old_page?num=', num, n_list)
  22. return easy_minify(flask.render_template(skin_check(),
  23. imp = [load_lang('old_page'), wiki_set(), custom(), other2([0, 0])],
  24. data = div,
  25. menu = [['other', load_lang('return')]]
  26. ))