mirror of https://gitlab.com/pamhyr/pamhyr2
Pamhyr2: Fix some type compare.
parent
2af9b0018c
commit
01fd7dbec8
|
|
@ -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
|
||||
|
||||
|
|
|
|||
10
src/tools.py
10
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue