handler.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:icfpc2016-judge 作者: icfpc2016 项目源码 文件源码
def problem_view_handler(problem_id):
    try:
        problem_id = int(problem_id)
    except ValueError:
        bottle.abort(404, 'Problem not found.')
    try:
        problem = model.get_public_problem(problem_id=problem_id)
    except KeyError:
        bottle.abort(404, 'Problem not found.')
    owner = model.get_user(problem['owner'])
    problem_spec = model.load_blob(problem['problem_spec_hash'])
    snapshot_time, ranked_solutions = model.get_last_problem_ranking_snapshot(
        problem_id=problem_id, public_only=True)
    handler_util.inject_ranks_to_ranked_solutions(ranked_solutions)
    template_dict = {
        'problem': problem,
        'problem_spec': problem_spec,
        'owner': owner,
        'ranked_solutions': ranked_solutions,
        'snapshot_time': snapshot_time,
    }
    return handler_util.render('problem_view.html', template_dict)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号