From 30db375c4dc0215703791f54b2a7a4370d6c54ea Mon Sep 17 00:00:00 2001
From: Daniel <d.hornung@indiscale.com>
Date: Fri, 17 Feb 2023 12:50:48 +0100
Subject: [PATCH] ENH: Changed error into warning when importing from XML

This is a workaround against issue 89:
https://gitlab.com/caosdb/caosdb-pylib/-/issues/89
"to_xml / from_xml do not always work together well"
---
 src/caosdb/common/models.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py
index 046fa06b..9042cdf2 100644
--- a/src/caosdb/common/models.py
+++ b/src/caosdb/common/models.py
@@ -1170,7 +1170,7 @@ out: List[Entity]
             else:
                 raise TypeError(
                     'Child was neither a Property, nor a Parent, nor a Message.\
-                    Was ' + str(type(child)))
+                    Was ' + str(type(child)) + "\n" + str(child))
 
         # add VALUE
         value = None
@@ -2732,9 +2732,11 @@ class Container(list):
         elif isinstance(entity, QueryTemplate):
             super().append(entity)
         else:
-            raise TypeError(
-                "Entity was neither an id nor a name nor an entity." +
-                " (was " + str(type(entity)) + ")")
+            warn("Entity was neither an id nor a name nor an entity." +
+                 " (was " + str(type(entity)) + ":\n" + str(entity) + ")")
+            # raise TypeError(
+            #     "Entity was neither an id nor a name nor an entity." +
+            #     " (was " + str(type(entity)) + "\n" + str(entity) + ")")
 
         return self
 
-- 
GitLab