From 382d9b4f38cb1a9a9b75fa76e89da33039f45fa5 Mon Sep 17 00:00:00 2001 From: Matthew Evans <7916000+ml-evs@users.noreply.github.com> Date: Sat, 12 Oct 2024 16:26:26 +0100 Subject: [PATCH] Guard against immutable ID not being returned from create collection (#35) --- src/datalab_api/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/datalab_api/__init__.py b/src/datalab_api/__init__.py index e825493..c6b605e 100644 --- a/src/datalab_api/__init__.py +++ b/src/datalab_api/__init__.py @@ -131,7 +131,8 @@ def create_item( try: collection_immutable_id = self.get_collection(collection_id)["immutable_id"] except RuntimeError: - collection_immutable_id = self.create_collection(collection_id)["immutable_id"] + self.create_collection(collection_id) + collection_immutable_id = self.get_collection(collection_id)["immutable_id"] new_item["collections"] = new_item.get("collections", []) new_item["collections"].append({"immutable_id": collection_immutable_id})