Skip to content

Commit

Permalink
Merge pull request #778 from seth-shaw-asu/merleaux-virks
Browse files Browse the repository at this point in the history
Make empty field checks pythonic
  • Loading branch information
mjordan authored May 15, 2024
2 parents c197de3 + b720efb commit e7e55ca
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions workbench_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create(self, config, field_definitions, entity, row, field_name):
dictionary
A dictionary represeting the entity that is POSTed to Drupal as JSON.
"""
if row[field_name] is None:
if not row[field_name]:
return entity

if field_name in config["field_text_format_ids"]:
Expand Down Expand Up @@ -124,7 +124,7 @@ def update(
entity[field_name] = []
return entity

if row[field_name] is None:
if not row[field_name]:
return entity

if field_name in config["field_text_format_ids"]:
Expand Down Expand Up @@ -336,7 +336,7 @@ def create(self, config, field_definitions, entity, row, field_name):
dictionary
A dictionary represeting the entity that is POSTed to Drupal as JSON.
"""
if row[field_name] is None:
if not row[field_name]:
return entity

id_field = row.get(config.get("id_field", "not_applicable"), "not_applicable")
Expand Down Expand Up @@ -386,7 +386,7 @@ def update(
entity[field_name] = []
return entity

if row[field_name] is None:
if not row[field_name]:
return entity

if config["task"] == "update_terms":
Expand Down Expand Up @@ -530,7 +530,7 @@ def create(self, config, field_definitions, entity, row, field_name):
dictionary
A dictionary represeting the entity that is POSTed to Drupal as JSON.
"""
if row[field_name] is None:
if not row[field_name]:
return entity

id_field = row.get(config.get("id_field", "not_applicable"), "not_applicable")
Expand Down Expand Up @@ -581,7 +581,7 @@ def update(
entity[field_name] = []
return entity

if row[field_name] is None:
if not row[field_name]:
return entity

if config["task"] == "update_terms":
Expand Down Expand Up @@ -731,7 +731,7 @@ def create(self, config, field_definitions, entity, row, field_name):
dictionary
A dictionary represeting the entity that is POSTed to Drupal as JSON.
"""
if row[field_name] is None:
if not row[field_name]:
return entity

id_field = row.get(config.get("id_field", "not_applicable"), "not_applicable")
Expand Down Expand Up @@ -802,7 +802,7 @@ def update(
entity[field_name] = []
return entity

if row[field_name] is None:
if not row[field_name]:
return entity

if config["task"] == "update_terms":
Expand Down Expand Up @@ -984,7 +984,7 @@ def create(self, config, field_definitions, entity, row, field_name):
dictionary
A dictionary represeting the entity that is POSTed to Drupal as JSON.
"""
if row[field_name] is None:
if not row[field_name]:
return entity

id_field = row.get(config.get("id_field", "not_applicable"), "not_applicable")
Expand Down Expand Up @@ -1041,7 +1041,7 @@ def update(
entity[field_name] = []
return entity

if row[field_name] is None:
if not row[field_name]:
return entity

if config["task"] == "update_terms":
Expand Down Expand Up @@ -1208,7 +1208,7 @@ def create(self, config, field_definitions, entity, row, field_name):
dictionary
A dictionary represeting the entity that is POSTed to Drupal as JSON.
"""
if row[field_name] is None:
if not row[field_name]:
return entity

id_field = row.get(config.get("id_field", "not_applicable"), "not_applicable")
Expand Down Expand Up @@ -1254,7 +1254,7 @@ def update(
entity[field_name] = []
return entity

if row[field_name] is None:
if not row[field_name]:
return entity

if config["task"] == "update_terms":
Expand Down Expand Up @@ -1411,7 +1411,7 @@ def create(self, config, field_definitions, entity, row, field_name):
dictionary
A dictionary represeting the entity that is POSTed to Drupal as JSON.
"""
if row[field_name] is None:
if not row[field_name]:
return entity

id_field = row.get(config.get("id_field", "not_applicable"), "not_applicable")
Expand Down Expand Up @@ -1460,7 +1460,7 @@ def update(
entity[field_name] = []
return entity

if row[field_name] is None:
if not row[field_name]:
return entity

cardinality = int(field_definitions[field_name].get("cardinality", -1))
Expand Down Expand Up @@ -1616,7 +1616,7 @@ def create(self, config, field_definitions, entity, row, field_name):
dictionary
A dictionary represeting the entity that is POSTed to Drupal as JSON.
"""
if row[field_name] is None:
if not row[field_name]:
logging.warning(f'Did not find "{field_name}" in row.')
return entity
id_field = row.get(config.get("id_field", "not_applicable"), "not_applicable")
Expand Down Expand Up @@ -1855,7 +1855,7 @@ def update(
entity[field_name] = []
return entity

if row[field_name] is None:
if not row[field_name]:
return entity

if config["update_mode"] == "replace":
Expand Down

0 comments on commit e7e55ca

Please sign in to comment.