1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 15:19:59 +00:00

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, ['???'])) 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 @cached_function
def get_category_id_map(): def get_category_id_map():
''' Reads database for categories and turns them into a dict with ''' 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 = flask.Blueprint('main', __name__)
@bp.app_errorhandler(404)
def not_found(error):
return flask.render_template('404.html'), 404
@bp.before_app_request @bp.before_app_request
def before_request(): def before_request():
flask.g.user = None flask.g.user = None