mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Pamhyr2: Fix some type compare.
This commit is contained in:
1 parent
2af9b0018c
commit
01fd7dbec8
2 files changed
+7
-7
No files matched your search
@@ -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
|
||||
|
||||
|
||||
+5
-5
@@ -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
|
||||
|
||||
Reference in new issue
Block a user