From a360d4fe8845dcc55adbb840dbca46b15ac57f32 Mon Sep 17 00:00:00 2001 From: florian <f.spreckelsen@inidscale.com> Date: Thu, 9 Jul 2020 13:33:04 +0200 Subject: [PATCH] BUG: Remove remaining ContainerErrors --- src/caosdb/common/models.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py index baf972e8..3d93cad3 100644 --- a/src/caosdb/common/models.py +++ b/src/caosdb/common/models.py @@ -2637,10 +2637,10 @@ class Container(list): if len(self) == 0: if raise_exception_on_error: - ce = ContainerError( - "There are no entities to be deleted. This container is empty.", - self) - raise TransactionError(ce) + te = TransactionError( + msg="There are no entities to be deleted. This container is empty.", + container=self) + raise te return self self.clear_server_messages() @@ -2672,9 +2672,10 @@ class Container(list): if len(id_str) == 0: if raise_exception_on_error: - ce = ContainerError( - "There are no entities to be deleted.", self) - raise TransactionError(ce) + te = TransactionError( + msg="There are no entities to be deleted.", + continer=self) + raise te return self entity_url_segments = [_ENTITY_URI_SEGMENT, "&".join(id_str)] @@ -2828,10 +2829,10 @@ class Container(list): """Update these entites.""" if len(self) < 1: - ce = ContainerError( - "There are no entities to be updated. This container is empty.", - self) - raise TransactionError(ce) + te = TransactionError( + msg="There are no entities to be updated. This container is empty.", + container=self) + raise te self.clear_server_messages() insert_xml = etree.Element("Update") @@ -3021,10 +3022,10 @@ class Container(list): insert_xml.append(entity_xml) if len(self) > 0 and len(insert_xml) < 1: - ce = ContainerError( - "There are no entities to be inserted. This container contains existent entities only.", - self) - raise TransactionError(ce) + te = TransactionError( + msg="There are no entities to be inserted. This container contains existent entities only.", + container=self) + raise te _log_request("POST: " + _ENTITY_URI_SEGMENT + ('' if flags is None else "?" + str(flags)), insert_xml) -- GitLab