Skip to content

Commit 0f12c43

Browse files
committed
Fixed issues with object instance becoming string
1 parent 5aa9306 commit 0f12c43

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

mysql/1.0.0/src/app.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def create_database(self, server, user, password, database, name, tables=None):
5252
return err
5353
else:
5454
if tables:
55-
if not isinstance(tables, list) and not isinstance(tables, object) and not isinstance(tables, dict):
55+
if not isinstance(tables, list) and not isinstance(tables, dict):
5656
tables = json.loads(tables)
5757

5858
t_count = 0
@@ -86,7 +86,7 @@ def create_database(self, server, user, password, database, name, tables=None):
8686

8787
# Create Tables
8888
def create_tables(self, server, user, password, database, tables):
89-
if not isinstance(tables, list) and not isinstance(tables, object) and not isinstance(tables, dict):
89+
if not isinstance(tables, list) and not isinstance(tables, dict):
9090
tables = json.loads(tables)
9191

9292
try:
@@ -138,7 +138,7 @@ def create_tables(self, server, user, password, database, tables):
138138

139139
# Insert data into table
140140
def insert_data(self, server, user, password, database, table, data):
141-
if not isinstance(data, list) and not isinstance(data, object) and not isinstance(data, dict):
141+
if not isinstance(data, list) and not isinstance(data, dict):
142142
data = json.loads(data)
143143

144144
try:

shuffle-tools/1.2.0/src/app.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,11 @@ def set_json_key(self, json_object, key, value):
317317
"reason": "Item is valid JSON, but can't handle lists. Use .#"
318318
}
319319

320-
if not isinstance(json_object, object):
321-
return {
322-
"success": False,
323-
"reason": "Item is not valid JSON (2)"
324-
}
320+
#if not isinstance(json_object, object):
321+
# return {
322+
# "success": False,
323+
# "reason": "Item is not valid JSON (2)"
324+
# }
325325

326326

327327
if isinstance(value, str):
@@ -404,7 +404,7 @@ def replace_value(self, input_data, translate_from, translate_to, else_value="")
404404
return input_data
405405

406406
def replace_value_from_dictionary(self, input_data, mapping, default_value=""):
407-
if not isinstance(mapping, dict) and not isinstance(mapping, object):
407+
if isinstance(mapping, str):
408408
try:
409409
mapping = json.loads(mapping)
410410
except json.decoder.JSONDecodeError as e:
@@ -1419,14 +1419,15 @@ def merge_lists(self, list_one, list_two, set_field="", sort_key_list_one="", so
14191419
return list_one
14201420

14211421
def xml_json_convertor(self, convertto, data):
1422-
if isinstance(data, dict) or isinstance(data, object) or isinstance(data, list):
1422+
if isinstance(data, dict) or isinstance(data, list):
14231423
try:
14241424
data = json.dumps(data)
14251425
except:
14261426
pass
14271427

14281428
try:
14291429
if convertto == "json":
1430+
data = data.replace(" encoding=\"utf-8\"", " ")
14301431
ans = xmltodict.parse(data)
14311432
json_data = json.dumps(ans)
14321433
return json_data
@@ -1448,7 +1449,7 @@ def date_to_epoch(self, input_data, date_field, date_format):
14481449
)
14491450
)
14501451

1451-
if not isinstance(input_data, dict) and not isinstance(input_data, object):
1452+
if isinstance(input_data, str):
14521453
result = json.loads(input_data)
14531454
else:
14541455
result = input_data
@@ -1573,7 +1574,7 @@ def check_cache_contains(self, key, value, append):
15731574
"key": key,
15741575
}
15751576

1576-
if isinstance(value, dict) or isinstance(value, list) or isinstance(value, object):
1577+
if isinstance(value, dict) or isinstance(value, list):
15771578
try:
15781579
value = json.dumps(value)
15791580
except Exception as e:
@@ -1767,7 +1768,7 @@ def set_cache_value(self, key, value):
17671768
org_id = self.full_execution["workflow"]["execution_org"]["id"]
17681769
url = "%s/api/v1/orgs/%s/set_cache" % (self.url, org_id)
17691770

1770-
if isinstance(value, dict) or isinstance(value, list) or isinstance(value, object):
1771+
if isinstance(value, dict) or isinstance(value, list):
17711772
try:
17721773
value = json.dumps(value)
17731774
except Exception as e:

0 commit comments

Comments
 (0)