fix: metal archives artist sources

This commit is contained in:
2023-09-13 16:01:01 +02:00
parent 8091a9ffb0
commit 13b9c0b35e
11 changed files with 129 additions and 47 deletions

View File

@@ -81,6 +81,8 @@ class Collection(Generic[T]):
:param merge_into_existing:
:return did_not_exist:
"""
if element is None:
return AppendResult(False, None, False)
# if the element type has been defined in the initializer it checks if the type matches
if self.element_type is not None and not isinstance(element, self.element_type):

View File

@@ -31,7 +31,7 @@ class DatabaseObject:
"""
_id = random.randint(0, HIGHEST_ID)
self.automatic_id = True
LOGGER.debug(f"Id for {type(self).__name__} isn't set. Setting to {_id}")
# LOGGER.debug(f"Id for {type(self).__name__} isn't set. Setting to {_id}")
# The id can only be None, if the object is dynamic (self.dynamic = True)
self.id: Optional[int] = _id

View File

@@ -649,11 +649,12 @@ class Artist(MainObject):
return metadata
def __str__(self):
def __str__(self, include_notes: bool = False):
string = self.name or ""
plaintext_notes = self.notes.get_plaintext()
if plaintext_notes is not None:
string += "\n" + plaintext_notes
if include_notes:
plaintext_notes = self.notes.get_plaintext()
if plaintext_notes is not None:
string += "\n" + plaintext_notes
return string
def __repr__(self):