aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorBonfaceKilz2020-12-01 23:34:36 +0300
committerBonfaceKilz2020-12-01 23:34:36 +0300
commit6a2fb6cced98d79cd1ccbe6490a59393486fdf92 (patch)
tree96e8e17b8467a392b77c7aa632cdc9c1de322279 /wqflask
parent719ce04cefe84e62662bca1404776a3f55251cc5 (diff)
downloadgenenetwork2-6a2fb6cced98d79cd1ccbe6490a59393486fdf92.tar.gz
Add new function to fetch md file from sys paths
* wqflask/wqflask/markdown_routes.py: New imports. (get_file_from_python_search_path): New function.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/markdown_routes.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/wqflask/wqflask/markdown_routes.py b/wqflask/wqflask/markdown_routes.py
index 1e077dd1..e43b9860 100644
--- a/wqflask/wqflask/markdown_routes.py
+++ b/wqflask/wqflask/markdown_routes.py
@@ -4,6 +4,8 @@ Render pages from github, or if they are unavailable, look for it else where
"""
import requests
import markdown
+import os
+import sys
from flask import Blueprint
from flask import render_template
@@ -33,6 +35,14 @@ look for it inside the file system """
"Please reach out to the gn2 team to have a look at this")
+def get_file_from_python_search_path(pathname_suffix):
+ cands = [os.path.join(d, pathname_suffix) for d in sys.path]
+ try:
+ return list(filter(os.path.exists, cands))[0]
+ except IndexError:
+ return None
+
+
@glossary_blueprint.route('/')
def glossary():
return render_template(