diff options
-rw-r--r-- | wqflask/wqflask/markdown_routes.py | 10 |
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( |