utils.py 文件源码

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

项目:sysu-ctf 作者: ssst0n3 项目源码 文件源码
def init_utils(app):
    app.jinja_env.filters['unix_time'] = unix_time
    app.jinja_env.filters['unix_time_millis'] = unix_time_millis
    app.jinja_env.filters['long2ip'] = long2ip
    app.jinja_env.globals.update(pages=pages)
    app.jinja_env.globals.update(can_register=can_register)
    app.jinja_env.globals.update(mailserver=mailserver)
    app.jinja_env.globals.update(ctf_name=ctf_name)

    @app.context_processor
    def inject_user():
        if authed():
            return dict(session)
        return dict()

    @app.before_request
    def needs_setup():
        if request.path == '/setup' or request.path.startswith('/static'):
            return
        if not is_setup():
            return redirect('/setup')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号