diff --git a/requirements.in b/requirements.in index b263fad5..6586dd57 100644 --- a/requirements.in +++ b/requirements.in @@ -1,10 +1,10 @@ -opengeode-core==15.31.5 -opengeode-io==7.4.8 -opengeode-inspector==6.8.17 -opengeode-geosciences==9.5.9 -opengeode-geosciencesio==5.8.10 -geode-common==33.19.0 -geode-viewables==3.3.4 +opengeode-core==16.0.0 +opengeode-io==7.4.9 +opengeode-inspector==6.8.18 +opengeode-geosciences==9.5.10 +opengeode-geosciencesio==5.8.11 +geode-common==33.19.1 +geode-viewables==3.3.5 flask[async]==3.1.2 flask-cors==6.0.1 werkzeug==3.1.2 diff --git a/requirements.txt b/requirements.txt index 306b0b46..4504a827 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,11 +16,11 @@ flask[async]>=3 # flask-cors flask-cors==6.0.1 # via -r requirements.in -geode-common==33.19.0 +geode-common==33.19.1 # via # -r requirements.in # geode-viewables -geode-viewables==3.3.4 +geode-viewables==3.3.5 # via -r requirements.in itsdangerous>=2 # via flask @@ -31,7 +31,7 @@ markupsafe>=3 # flask # jinja2 # werkzeug -opengeode-core==15.31.5 +opengeode-core==16.0.0 # via # -r requirements.in # geode-common @@ -40,16 +40,16 @@ opengeode-core==15.31.5 # opengeode-geosciencesio # opengeode-inspector # opengeode-io -opengeode-geosciences==9.5.9 +opengeode-geosciences==9.5.10 # via # -r requirements.in # geode-viewables # opengeode-geosciencesio -opengeode-geosciencesio==5.8.10 +opengeode-geosciencesio==5.8.11 # via -r requirements.in -opengeode-inspector==6.8.17 +opengeode-inspector==6.8.18 # via -r requirements.in -opengeode-io==7.4.8 +opengeode-io==7.4.9 # via # -r requirements.in # geode-viewables @@ -60,4 +60,3 @@ werkzeug==3.1.2 # flask # flask-cors -opengeodeweb-microservice==1.*,>=1.0.15 diff --git a/src/opengeodeweb_back/routes/blueprint_routes.py b/src/opengeodeweb_back/routes/blueprint_routes.py index f16345b3..fbc14653 100644 --- a/src/opengeodeweb_back/routes/blueprint_routes.py +++ b/src/opengeodeweb_back/routes/blueprint_routes.py @@ -184,7 +184,7 @@ def inspect_file() -> flask.Response: return flask.make_response({"inspection_result": inspection_result}, 200) -def extract_inspector_result(inspection_data: Any) -> object: +def extract_inspector_result(inspection_data: Any) -> dict[str, Any]: new_object = {} if hasattr(inspection_data, "inspection_type"): @@ -195,14 +195,17 @@ def extract_inspector_result(inspection_data: Any) -> object: if child.startswith("__") or child in [ "inspection_type", "string", + "nb_issues", ]: continue child_instance = getattr(inspection_data, child) + if callable(child_instance): + continue child_object = extract_inspector_result(child_instance) new_object["children"].append(child_object) - if hasattr(child_object, "nb_issues"): - new_object["nb_issues"] += child_object.nb_issues() - else: + if "nb_issues" in child_object: + new_object["nb_issues"] += child_object["nb_issues"] + elif hasattr(inspection_data, "description"): new_object["title"] = inspection_data.description() nb_issues = inspection_data.nb_issues() new_object["nb_issues"] = nb_issues diff --git a/src/opengeodeweb_back/utils_functions.py b/src/opengeodeweb_back/utils_functions.py index 89bc0a2c..1943c77f 100644 --- a/src/opengeodeweb_back/utils_functions.py +++ b/src/opengeodeweb_back/utils_functions.py @@ -215,11 +215,14 @@ def save_all_viewables_and_return_info( assert data.native_file is not None assert data.viewable_file is not None assert data.light_viewable_file is not None + name = geode_object.identifier.name() + if not name: + flask.abort(400, "Geode object has no name defined.") return { "native_file": data.native_file, "viewable_file": data.viewable_file, "id": data.id, - "name": geode_object.identifier.name(), + "name": name, "viewer_type": data.viewer_object, "binary_light_viewable": binary_light_viewable.decode("utf-8"), "geode_object_type": data.geode_object, diff --git a/tests/test_geode_functions.py b/tests/test_geode_functions.py index ef0d00ee..ee9325da 100644 --- a/tests/test_geode_functions.py +++ b/tests/test_geode_functions.py @@ -26,7 +26,9 @@ def test_input_output() -> None: if generic_geode_object.is_loadable(file_absolute_path).value() == 0.0: continue geode_object = generic_geode_object.load(file_absolute_path) - data_name = geode_object.identifier.name() + data_name = geode_object.identifier.name() or os.path.basename( + file_absolute_path + ) if geode_object.is_viewable(): viewable_file_path = geode_object.save_viewable( os.path.join(os.path.abspath(f"./output"), data_name)