From 55ff7a6eb8391f8c1dd0e62758af824fad9c2b9c Mon Sep 17 00:00:00 2001 From: Michael Polidori Date: Wed, 10 Nov 2021 10:26:01 -0500 Subject: [PATCH] Fix/tmp filter value 2 (#514) --- ckanext/querytool/helpers.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ckanext/querytool/helpers.py b/ckanext/querytool/helpers.py index 1eb32bee..2876f896 100644 --- a/ckanext/querytool/helpers.py +++ b/ckanext/querytool/helpers.py @@ -294,7 +294,11 @@ def _create_where_clause(filters): for idx, _ in enumerate(filters): op = u'=' name = _['name'] - value = _['value'].replace('\'', '\'\'') + + if isinstance(_['value'], str): + value = _['value'].replace('\'', '\'\'') + else: + value = _['value'] if idx == 0: where_clause = u'WHERE ("{0}" {1} \'{2}\')'.format( @@ -307,7 +311,12 @@ def _create_where_clause(filters): _ = filters[0] op = u'=' name = _['name'] - value = _['value'] + + if isinstance(_['value'], str): + value = _['value'].replace('\'', '\'\'') + else: + value = _['value'] + where_clause = \ u'WHERE ("{0}" {1} \'{2}\')'.format( name,