From df81b88f17c21f0bd891ea8784fc0609b885d558 Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Tue, 1 Dec 2020 23:07:38 +0100
Subject: [PATCH] FIX id in [...] filter

---
 djaosdb/caosdb_client.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/djaosdb/caosdb_client.py b/djaosdb/caosdb_client.py
index d8d38eb..71f9a8f 100644
--- a/djaosdb/caosdb_client.py
+++ b/djaosdb/caosdb_client.py
@@ -144,16 +144,16 @@ class DefaultCaosDBClientDelegate:
         if filter_type in ["reference", "back_reference"]:
             return self._get_reference_clause(**fil)
         if filter_type == "in":
-            p = fil["p"]
+            p = fil["p"] if fil["p"] == "id" else f'"{fil["p"]}"'
             values = fil["v"]
-            components = [f' "{p}" = ' + str(val) for val in values]
+            components = [f' {p} = ' + str(val) for val in values]
             return " OR".join(components)
         if filter_type == "pov":
             n = "NOT " if fil["negation"] is True else ""
-            p = fil["p"]
+            p = fil["p"] if fil["p"] == "id" else f'"{fil["p"]}"'
             o = fil["o"]
             v = fil["v"]
-            return f' {n}"{p}"{o}"{v}"'
+            return f' {n}{p}{o}"{v}"'
         raise NotImplementedError("_get_filter_clause(%s)", fil)
 
     def _find(self, record_type, *args, **kwargs):
-- 
GitLab