From 1728cf80f1866dcd3d1d0821a0bd938e3d85dd60 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Thu, 24 Nov 2022 13:56:52 +0100
Subject: [PATCH] FIX: backrefs attribute may contain Entities

---
 src/caoscrawler/identifiable_adapters.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/caoscrawler/identifiable_adapters.py b/src/caoscrawler/identifiable_adapters.py
index 27332e76..acbc1952 100644
--- a/src/caoscrawler/identifiable_adapters.py
+++ b/src/caoscrawler/identifiable_adapters.py
@@ -101,7 +101,10 @@ class IdentifiableAdapter(metaclass=ABCMeta):
         if ident.record_type is not None:
             query_string += ident.record_type
         for ref in ident.backrefs:
-            query_string += (" WHICH IS REFERENCED BY " + str(ref) + " AND")
+            eid = ref
+            if isinstance(ref, db.Entity):
+                eid = ref.id
+            query_string += (" WHICH IS REFERENCED BY " + str(eid) + " AND")
 
         query_string += " WITH "
 
-- 
GitLab