You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bilog2sql_util.py --> fix_object
def fix_object(value, trans_json_str=True):
"""Fixes python objects so that they can be properly inserted into SQL queries"""
if isinstance(value, set):
value = ','.join(value)
if PY3PLUS and isinstance(value, bytes):
return value.decode('utf-8')
elif not PY3PLUS and isinstance(value, unicode):
return value.encode('utf-8')
elif isinstance(value, dict):
new_dict = dict([(k, fix_object(v, trans_json_str=False)) for k, v in value.items()])
if trans_json_str:
r_data = json.dumps(new_dict, encoding='utf-8', ensure_ascii=False)
else:
r_data = new_dict
return r_data
elif isinstance(value, list):
new_list = []
for v_item in value:
new_list.append(fix_object(v_item, trans_json_str=False))
if trans_json_str:
r_data = json.dumps(new_list, encoding='utf-8', ensure_ascii=False)
else:
r_data = new_list
return r_data
else:
return value
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: