From 62f02fbc71cf8383078c3ab290bcd342e677080c Mon Sep 17 00:00:00 2001
From: Dorian Koch <doriank@fsmpi.rwth-aachen.de>
Date: Sun, 13 Oct 2024 11:58:56 +0200
Subject: [PATCH] Fix object serialization

---
 src/videoag_common/api_object/object_class.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/videoag_common/api_object/object_class.py b/src/videoag_common/api_object/object_class.py
index aff041a..12db900 100644
--- a/src/videoag_common/api_object/object_class.py
+++ b/src/videoag_common/api_object/object_class.py
@@ -333,10 +333,10 @@ class ApiObjectClass:
         context = getattr(args, context_name)
         if not isinstance(context, dict):
             raise Exception(f"serialization argument '{context_name}' must be a dict")
-        if str(self.id) not in context:
-            context[str(self.id)] = None  # Indicate that object is being serialized. Prevent loops
-            context[str(self.id)] = self.serialize_object_args(obj, args, to_context=False)
-        return self.id
+        if str(obj.id) not in context:
+            context[str(obj.id)] = None  # Indicate that object is being serialized. Prevent loops
+            context[str(obj.id)] = self.serialize_object_args(obj, args, to_context=False)
+        return obj.id
     
     def get_creation_config(self) -> JsonTypes or None:
         if not self.enable_config:
-- 
GitLab