diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b0ef99d1342944901ef3affc4e034356b933c72..4d42e0b26a2b493d210ff0a55105d70cfd6c90a3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,8 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### * `_Messages` is now `Messages` and inherits from list instead of dict -* `Message.__init__` signature changed and expects a `description` now while - `type` defaults to "Info" now. +* `Message.__init__` signature changed and `type` defaults to "Info" now. * `Message.__eq__` changed. Equality is equality of `type`, `code`, and `description` now. diff --git a/src/caosdb/common/models.py b/src/caosdb/common/models.py index 697c3969d7579a22a97962c796e524d702fe8033..df77bb7311a86abc8a78715e082f115c6a3efc2b 100644 --- a/src/caosdb/common/models.py +++ b/src/caosdb/common/models.py @@ -682,7 +682,8 @@ class Entity: if msg is not None: pass else: - msg = Message(type, code, description, body) + msg = Message(description=description, type=type, code=code, + body=body) self.messages.append(msg) return self @@ -1870,7 +1871,7 @@ class Property(Entity): class Message(object): - def __init__(self, description, type=None, code=None, body=None): # @ReservedAssignment + def __init__(self, type=None, code=None, description=None, body=None): # @ReservedAssignment self.description = description self.type = type if type is not None else "Info" self.code = int(code) if code is not None else None @@ -3137,7 +3138,7 @@ class Container(list): msg = "Request was not unique. CUID " + \ str(local_entity._cuid) + " was found " + \ str(len(sync_remote_entities)) + " times." - local_entity.add_message(Message("Error", None, msg)) + local_entity.add_message(Message(description=msg, type="Error")) if raise_exception_on_error: raise MismatchingEntitiesError(msg) @@ -3162,7 +3163,7 @@ class Container(list): msg = "Request was not unique. ID " + \ str(local_entity.id) + " was found " + \ str(len(sync_remote_entities)) + " times." - local_entity.add_message(Message("Error", None, msg)) + local_entity.add_message(Message(description=msg, type="Error")) if raise_exception_on_error: raise MismatchingEntitiesError(msg) @@ -3192,7 +3193,7 @@ class Container(list): msg = "Request was not unique. Path " + \ str(local_entity.path) + " was found " + \ str(len(sync_remote_entities)) + " times." - local_entity.add_message(Message("Error", None, msg)) + local_entity.add_message(Message(description=msg, type="Error")) if raise_exception_on_error: raise MismatchingEntitiesError(msg) @@ -3222,7 +3223,7 @@ class Container(list): msg = "Request was not unique. Name " + \ str(local_entity.name) + " was found " + \ str(len(sync_remote_entities)) + " times." - local_entity.add_message(Message("Error", None, msg)) + local_entity.add_message(Message(description=msg, type="Error")) if raise_exception_on_error: raise MismatchingEntitiesError(msg) @@ -3241,7 +3242,7 @@ class Container(list): msg = "Request was not unique. There are " + \ str(len(sync_remote_entities)) + \ " entities which could not be matched to one of the requested ones." - remote_container.add_message(Message("Error", None, msg)) + remote_container.add_message(Message(description=msg, type="Error")) if raise_exception_on_error: raise MismatchingEntitiesError(msg)