def problem_list_handler():
try:
page = int(bottle.request.query.get('page', 1))
except ValueError:
page = 1
count = model.count_public_problems()
problems = model.get_public_problems(
limit=FLAGS.pagination_items_per_page,
skip=(page - 1) * FLAGS.pagination_items_per_page)
team_display_name_map = handler_util.compute_team_display_name_map(
problem['owner'] for problem in problems)
pagination = handler_util.Pagination(
page, FLAGS.pagination_items_per_page, count)
template_dict = {
'problems': problems,
'team_display_name_map': team_display_name_map,
'pagination': pagination,
}
return handler_util.render('problem_list.html', template_dict)
评论列表
文章目录