Be a bit more resilient if an upstream integration sent some empty entities

This commit is contained in:
Fabio Manganiello 2023-04-23 22:48:15 +02:00
parent 6711b26137
commit 9c03b028d7

View file

@ -68,6 +68,9 @@ class EntityManager(ABC):
def _normalize_entities(self, entities: Collection[Entity]) -> Collection[Entity]: def _normalize_entities(self, entities: Collection[Entity]) -> Collection[Entity]:
for entity in entities: for entity in entities:
if not entity:
continue
if entity.id and not entity.external_id: if entity.id and not entity.external_id:
# Entity IDs can only refer to the internal primary key # Entity IDs can only refer to the internal primary key
entity.external_id = entity.id entity.external_id = entity.id