Skip to content

Commit b591816

Browse files
mattiagiupponigiohappy
authored andcommitted
Gemini review fix
1 parent 8514c16 commit b591816

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

geonode/upload/handlers/common/vector.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,12 +608,11 @@ def setup_dynamic_model(
608608
"""
609609

610610
layer_name = self.fixup_name(layer.GetName() if isinstance(layer, ogr.Layer) else layer)
611-
is_dynamic_model_managed = orchestrator.get_execution_object(execution_id).input_params.get(
612-
"is_dynamic_model_managed", False
613-
)
614-
workspace = DataPublisher(None).workspace
611+
_exec_obj = orchestrator.get_execution_object(execution_id)
615612

616-
if resource_pk := orchestrator.get_execution_object(execution_id).input_params.get("resource_pk", None):
613+
is_dynamic_model_managed = _exec_obj.input_params.get("is_dynamic_model_managed", False)
614+
workspace = DataPublisher(None).workspace
615+
if resource_pk := _exec_obj.input_params.get("resource_pk", None):
617616
user_datasets = Dataset.objects.filter(owner=username, pk=resource_pk)
618617
else:
619618
user_datasets = Dataset.objects.filter(owner=username, alternate__iexact=f"{workspace.name}:{layer_name}")

geonode/upload/handlers/tiles3d/handler.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,13 @@ def create_geonode_resource(
277277
return resource
278278

279279
def create_asset_and_link(self, resource, files, action=None, asset_name=None, asset_type=None, **kwargs):
280+
"""
281+
Overrides the base handler to prevent double asset creation for 3D tiles.
282+
283+
This handler's `create_geonode_resource` method already creates the necessary asset.
284+
This override ensures that the subsequent generic call from the celery task does not create a duplicate asset.
285+
The asset is only created by calling the parent method if both `asset_type` and `extension` are explicitly provided.
286+
"""
280287
if asset_type and kwargs.get("extension", None):
281288
return super().create_asset_and_link(resource, files, action, asset_name, asset_type, **kwargs)
282289

0 commit comments

Comments
 (0)