mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-11-01 02:25:55 +00:00
Move 404 handler into 'main' blueprint
This commit is contained in:
parent
4aac17ff23
commit
42535bbdab
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue