Skip to content

Commit

Permalink
Address 'int' object has no attribute 'split' exception reported in #756
Browse files Browse the repository at this point in the history
.
  • Loading branch information
mjordan committed Apr 2, 2024
1 parent 76736ba commit c2d6146
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions workbench_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def create(self, config, field_definitions, entity, row, field_name):

id_field = row.get(config.get("id_field", "not_applicable"), "not_applicable")
field_values = []
subvalues = row[field_name].split(config["subdelimiter"])
subvalues = str(row[field_name]).split(config["subdelimiter"])
subvalues = self.remove_invalid_values(
config, field_definitions, field_name, subvalues
)
Expand Down Expand Up @@ -141,7 +141,7 @@ def update(

cardinality = int(field_definitions[field_name].get("cardinality", -1))
if config["update_mode"] == "append":
subvalues = row[field_name].split(config["subdelimiter"])
subvalues = str(row[field_name]).split(config["subdelimiter"])
subvalues = self.remove_invalid_values(
config, field_definitions, field_name, subvalues
)
Expand Down Expand Up @@ -169,7 +169,7 @@ def update(
entity[field_name] = entity[field_name][:cardinality]
if config["update_mode"] == "replace":
field_values = []
subvalues = row[field_name].split(config["subdelimiter"])
subvalues = str(row[field_name]).split(config["subdelimiter"])
subvalues = self.remove_invalid_values(
config, field_definitions, field_name, subvalues
)
Expand Down Expand Up @@ -739,7 +739,7 @@ def create(self, config, field_definitions, entity, row, field_name):
target_type = "taxonomy_term"
field_vocabs = get_field_vocabularies(config, field_definitions, field_name)
prepared_tids = []
delimited_values = row[field_name].split(config["subdelimiter"])
delimited_values = str(row[field_name]).split(config["subdelimiter"])
for delimited_value in delimited_values:
tid = prepare_term_id(config, field_vocabs, field_name, delimited_value)
if value_is_numeric(tid):
Expand All @@ -756,7 +756,7 @@ def create(self, config, field_definitions, entity, row, field_name):
target_type = "media_type"

field_values = []
subvalues = row[field_name].split(config["subdelimiter"])
subvalues = str(row[field_name]).split(config["subdelimiter"])
subvalues = self.dedupe_values(subvalues)
for subvalue in subvalues:
subvalue = str(subvalue)
Expand Down Expand Up @@ -816,7 +816,7 @@ def update(
target_type = "taxonomy_term"
field_vocabs = get_field_vocabularies(config, field_definitions, field_name)
prepared_tids = []
delimited_values = row[field_name].split(config["subdelimiter"])
delimited_values = str(row[field_name]).split(config["subdelimiter"])
for delimited_value in delimited_values:
tid = prepare_term_id(config, field_vocabs, field_name, delimited_value)
if value_is_numeric(tid):
Expand All @@ -835,7 +835,7 @@ def update(
cardinality = int(field_definitions[field_name].get("cardinality", -1))
if config["update_mode"] == "replace":
field_values = []
subvalues = row[field_name].split(config["subdelimiter"])
subvalues = str(row[field_name]).split(config["subdelimiter"])
subvalues = self.dedupe_values(subvalues)
for subvalue in subvalues:
field_values.append(
Expand All @@ -850,7 +850,7 @@ def update(
entity[field_name] = field_values

if config["update_mode"] == "append":
subvalues = row[field_name].split(config["subdelimiter"])
subvalues = str(row[field_name]).split(config["subdelimiter"])
for subvalue in subvalues:
entity_field_values.append(
{"target_id": str(subvalue), "target_type": target_type}
Expand Down Expand Up @@ -1636,7 +1636,7 @@ def create(self, config, field_definitions, entity, row, field_name):
paragraph_configs.get("subdelimiter", None) or config["subdelimiter"]
)

subvalues = row[field_name].split(subdelimiter)
subvalues = str(row[field_name]).split(subdelimiter)

# @todo self.dedup_values

Expand Down

0 comments on commit c2d6146

Please sign in to comment.