diff --git a/src/Model/Tools/PamhyrDB.py b/src/Model/Tools/PamhyrDB.py index bfea282e0944f75492d4e78e9cad4963f0d67ccd..8ee134fc97f7c725e0cbe1ebdc6fedb94ecb942f 100644 --- a/src/Model/Tools/PamhyrDB.py +++ b/src/Model/Tools/PamhyrDB.py @@ -115,9 +115,9 @@ class SQLSubModel(object): def _db_format(self, value): # Replace ''' by ''' to preserve SQL injection - if value is str: + if type(value) is str: value = value.replace("'", "'") - elif value is bool: + elif type(value) is bool: value = 'TRUE' if value else 'FALSE' return value diff --git a/src/tools.py b/src/tools.py index 657752e0bcdbfce01739865d30a96aff31764b9d..b6f78857a90de16178ce21d680047c6015e70b99 100644 --- a/src/tools.py +++ b/src/tools.py @@ -297,7 +297,7 @@ class SQL(object): def _fetch_tuple(self, tup): res = [] for v in tup: - if v is str: + if type(v) is str: v = self._fetch_string(v) res.append(v) @@ -306,9 +306,9 @@ class SQL(object): def _fetch_list(self, lst): res = [] for v in lst: - if v is str: + if type(v) is str: v = self._fetch_string(v) - elif v is tuple: + elif type(v) is tuple: v = self._fetch_tuple(v) res.append(v) @@ -321,9 +321,9 @@ class SQL(object): value = res.fetchall() res = value - if value is list: + if type(value) is list: res = self._fetch_list(value) - elif value is tuple: + elif type(value) is tuple: res = self._fetch_tuple(value) return res