Commit 01fd7dbe authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

Pamhyr2: Fix some type compare.

Showing with 7 additions and 7 deletions
+7 -7
......@@ -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
......
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment