mirror of
https://github.com/Sudo-JHare/FHIRFLARE-IG-Toolkit.git
synced 2025-11-05 13:35:15 +00:00
Hotifx
fix context relative path.
This commit is contained in:
parent
189ba1d18c
commit
5a6f2072d7
29
app.py
29
app.py
@ -5,6 +5,7 @@ CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
|
|||||||
# Introduce app_dir variable that can be overridden by environment
|
# Introduce app_dir variable that can be overridden by environment
|
||||||
app_dir = os.environ.get('APP_DIR', CURRENT_DIR)
|
app_dir = os.environ.get('APP_DIR', CURRENT_DIR)
|
||||||
sys.path.append(CURRENT_DIR)
|
sys.path.append(CURRENT_DIR)
|
||||||
|
#sys.path.append(os.path.abspath(os.path.dirname(__file__)))
|
||||||
import datetime
|
import datetime
|
||||||
import shutil
|
import shutil
|
||||||
import queue
|
import queue
|
||||||
@ -2402,19 +2403,21 @@ def api_retrieve_bundles():
|
|||||||
output_zip = os.path.join(temp_dir, zip_filename)
|
output_zip = os.path.join(temp_dir, zip_filename)
|
||||||
|
|
||||||
def generate():
|
def generate():
|
||||||
try:
|
# Push the application context manually for the generator's lifetime
|
||||||
yield from services.retrieve_bundles(
|
with app.app_context():
|
||||||
fhir_server_url=fhir_server_url,
|
try:
|
||||||
resources=resources,
|
yield from services.retrieve_bundles(
|
||||||
output_zip=output_zip,
|
fhir_server_url=fhir_server_url,
|
||||||
validate_references=validate_references,
|
resources=resources,
|
||||||
fetch_reference_bundles=fetch_reference_bundles,
|
output_zip=output_zip,
|
||||||
auth_type=auth_type,
|
validate_references=validate_references,
|
||||||
auth_token=auth_token
|
fetch_reference_bundles=fetch_reference_bundles,
|
||||||
)
|
auth_type=auth_type,
|
||||||
except Exception as e:
|
auth_token=auth_token
|
||||||
logger.error(f"Error in retrieve_bundles: {e}", exc_info=True)
|
)
|
||||||
yield json.dumps({"type": "error", "message": f"Unexpected error: {str(e)}"}) + "\n"
|
except Exception as e:
|
||||||
|
logger.error(f"Error in retrieve_bundles: {e}", exc_info=True)
|
||||||
|
yield json.dumps({"type": "error", "message": f"Unexpected error: {str(e)}"}) + "\n"
|
||||||
|
|
||||||
response = Response(generate(), mimetype='application/x-ndjson')
|
response = Response(generate(), mimetype='application/x-ndjson')
|
||||||
response.headers['X-Zip-Path'] = os.path.join('/tmp', zip_filename)
|
response.headers['X-Zip-Path'] = os.path.join('/tmp', zip_filename)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user