aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander_Kabui2024-09-13 15:46:27 +0300
committerAlexander_Kabui2024-09-13 15:46:27 +0300
commit954993cca85a90a1d2868a9852b685824686952e (patch)
treec52ac18ce7460c832ec97880e7f326be53784c68
parent904957b017179d530c60f4b231a26cc2b8747987 (diff)
downloadgenenetwork2-954993cca85a90a1d2868a9852b685824686952e.tar.gz
Define new blueprint for all gn_docs.
-rw-r--r--gn2/wqflask/__init__.py2
-rw-r--r--gn2/wqflask/api/markdown.py10
2 files changed, 12 insertions, 0 deletions
diff --git a/gn2/wqflask/__init__.py b/gn2/wqflask/__init__.py
index 00fe5127..d959598d 100644
--- a/gn2/wqflask/__init__.py
+++ b/gn2/wqflask/__init__.py
@@ -34,6 +34,7 @@ from gn2.wqflask.api.markdown import facilities_blueprint
from gn2.wqflask.api.markdown import blogs_blueprint
from gn2.wqflask.api.markdown import news_blueprint
from gn2.wqflask.api.markdown import xapian_syntax_blueprint
+from gn2.wqflask.api.markdown import gn_docs_blueprint
from gn2.wqflask.api.jobs import jobs as jobs_bp
from gn2.wqflask.oauth2.routes import oauth2
from gn2.wqflask.oauth2.client import user_logged_in
@@ -109,6 +110,7 @@ app.jinja_env.globals.update(
# Registering blueprints
+app.register_blueprint(gn_docs_blueprint, url_prefix="/gn_docs")
app.register_blueprint(glossary_blueprint, url_prefix="/glossary")
app.register_blueprint(references_blueprint, url_prefix="/references")
app.register_blueprint(links_blueprint, url_prefix="/links")
diff --git a/gn2/wqflask/api/markdown.py b/gn2/wqflask/api/markdown.py
index f0f94b52..9a43ecdb 100644
--- a/gn2/wqflask/api/markdown.py
+++ b/gn2/wqflask/api/markdown.py
@@ -29,6 +29,7 @@ news_blueprint = Blueprint("news_blueprint", __name__)
xapian_syntax_blueprint = Blueprint("xapian_syntax_blueprint", __name__)
blogs_blueprint = Blueprint("blogs_blueprint", __name__)
+gn_docs_blueprint = Blueprint("gn_docs_blueprint", __name__)
def fetch_raw_markdown(file_path):
@@ -243,3 +244,12 @@ def blogs_list():
blogs = get_blogs()
return render_template("blogs_list.html", blogs=blogs)
+
+
+@gn_docs_blueprint.errorhandler(requests.exceptions.HTTPError)
+def page_not_found(error):
+ """ Return error 404 """
+ return {"Reason": error.response.reason,
+ "error_status_code": error.response.status_code,
+ "error_msg": error.response.text
+ }