From bbc3af0ce696765fb50404aedf2d63f6cb86349c Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Tue, 7 May 2024 22:10:40 +0200
Subject: [PATCH] WIP: import

---
 src/linkahead/common/models.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/linkahead/common/models.py b/src/linkahead/common/models.py
index 4a8f4ce3..b6b49219 100644
--- a/src/linkahead/common/models.py
+++ b/src/linkahead/common/models.py
@@ -3842,6 +3842,11 @@ class Container(list):
 #                         continue
 #                     except KeyError:
 #                         pass
+
+        # we expect that every inserted entity produces
+        # exactly one entity in the server's response
+        sync_unique = True
+
         for entity in self:
             if entity.is_valid():
                 continue
@@ -3859,6 +3864,7 @@ class Container(list):
                 entity_xml.set("upload", entity._upload)
             elif hasattr(entity, 'recursive_import') and entity.recursive_import is True:
                 entity_xml.set("recursive_import", "true")
+                sync_unique=False
             elif hasattr(entity, 'import_file') and entity.import_file is True:
                 entity_xml.set("import", "true")
             insert_xml.append(entity_xml)
@@ -3893,7 +3899,7 @@ class Container(list):
 
         if sync:
 
-            self._sync(cresp, unique=unique,
+            self._sync(cresp, unique=sync_unique,
                        raise_exception_on_error=raise_exception_on_error)
 
             if raise_exception_on_error:
-- 
GitLab