Move 404 handler into 'main' blueprint

This commit is contained in:
Kfir Hadas 2017-07-11 00:55:26 +03:00
parent 4aac17ff23
commit 42535bbdab
2 changed files with 5 additions and 5 deletions

View File

@ -19,11 +19,6 @@ def category_name(cat_id):
return ' - '.join(get_category_id_map().get(cat_id, ['???']))
@app.errorhandler(404)
def not_found(error):
return flask.render_template('404.html'), 404
@cached_function
def get_category_id_map():
''' Reads database for categories and turns them into a dict with

View File

@ -14,6 +14,11 @@ from nyaa.views.account import logout
bp = flask.Blueprint('main', __name__)
@bp.app_errorhandler(404)
def not_found(error):
return flask.render_template('404.html'), 404
@bp.before_app_request
def before_request():
flask.g.user = None