From 0c4f9ac194aea8b3393e203f6acf68de1ab53975 Mon Sep 17 00:00:00 2001 From: Matthew Richards Date: Thu, 2 Dec 2021 19:12:29 +0000 Subject: [PATCH] move string conversion to `__str__()` #259 - This means when the input is of type `SearchAPIWhereFilter`, it won't execute Python ICAT code until the filter needs to be applied/processed --- datagateway_api/src/search_api/nested_where_filters.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/datagateway_api/src/search_api/nested_where_filters.py b/datagateway_api/src/search_api/nested_where_filters.py index 2c166e55..d31016f0 100644 --- a/datagateway_api/src/search_api/nested_where_filters.py +++ b/datagateway_api/src/search_api/nested_where_filters.py @@ -18,13 +18,12 @@ def __init__(self, lhs, rhs, joining_operator): :type joining_operator: :class:`str` """ - self.lhs = str(lhs) - self.rhs = str(rhs) - self.joining_operator = joining_operator + self.lhs = lhs + self.rhs = rhs def __str__(self): """ Join the condition on the left with the one on the right with the boolean operator """ - return f"({self.lhs} {self.joining_operator} {self.rhs})" + return f"({str(self.lhs)} {self.joining_operator} {str(self.rhs)})"