44import urllib .request
55
66import connexion
7- from flask import current_app , request , g
7+ from flask import current_app as app , request , g
8+
9+ from schematic import CONFIG
810
911from schematic .manifest .generator import ManifestGenerator
1012
1820
1921# @before_request
2022def get_manifest_route (schema_url , title , oauth , use_annotations ):
23+ # check if file exists at the path created, i.e., app.config['SCHEMATIC_CONFIG']
24+ path_to_config = app .config ["SCHEMATIC_CONFIG" ]
25+
26+ if os .path .isfile (path_to_config ):
27+ CONFIG .load_config (path_to_config )
28+ else :
29+ raise FileNotFoundError (
30+ f"No configuration file was found at this path: { path_to_config } "
31+ )
32+
2133 # retrieve a JSON-LD via URL and store it in a temporary location
2234 with urllib .request .urlopen (schema_url ) as response :
2335 with tempfile .NamedTemporaryFile (delete = False , suffix = ".jsonld" ) as tmp_file :
@@ -26,11 +38,6 @@ def get_manifest_route(schema_url, title, oauth, use_annotations):
2638 # get path to temporary JSON-LD file
2739 jsonld = tmp_file .name
2840
29- # Move schematic config parameters into FlaskApp config object if any
30- # current_app.config['model']
31- # current_app.config['input']
32- # current_app.config['location']
33-
3441 # request.data[]
3542 data_type = connexion .request .args ["data_type" ]
3643
0 commit comments