Skip to content
Snippets Groups Projects
Commit 49e4c837 authored by Patrick Jentsch's avatar Patrick Jentsch
Browse files

fix query_result path logic

parent ab9e5347
No related branches found
No related tags found
No related merge requests found
...@@ -336,7 +336,7 @@ def add_query_result(): ...@@ -336,7 +336,7 @@ def add_query_result():
db.session.flush() db.session.flush()
db.session.refresh(query_result) db.session.refresh(query_result)
try: try:
os.makedirs(query_result.path) os.makedirs(os.path.dirname(query_result.path))
except OSError: except OSError:
logging.error('Make dir {} led to an OSError!'.format(query_result.path)) # noqa logging.error('Make dir {} led to an OSError!'.format(query_result.path)) # noqa
db.session.rollback() db.session.rollback()
...@@ -344,11 +344,9 @@ def add_query_result(): ...@@ -344,11 +344,9 @@ def add_query_result():
return make_response( return make_response(
{'redirect_url': url_for('.add_query_result')}, 500) {'redirect_url': url_for('.add_query_result')}, 500)
# save the uploaded file # save the uploaded file
query_result_file_path = os.path.join(query_result.path, form.file.data.save(query_result.path)
query_result.filename)
form.file.data.save(query_result_file_path)
# parse json from file # parse json from file
with open(query_result_file_path, 'r') as file: with open(query_result.path, 'r') as file:
query_result_file_content = json.load(file) query_result_file_content = json.load(file)
# parse json schema # parse json schema
with open('app/static/json_schema/nopaque_cqi_py_results_schema.json', 'r') as file: # noqa with open('app/static/json_schema/nopaque_cqi_py_results_schema.json', 'r') as file: # noqa
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment