Skip to content

Commit

Permalink
WIP on #776.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Apr 5, 2024
1 parent 0824988 commit d2f072e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
9 changes: 6 additions & 3 deletions workbench
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,10 @@ def update():
)

if node_has_all_fields is True:
node_endpoint = config["host"] + "/node/" + row["node_id"] + "?_format=json"
if value_is_numeric(row["node_id"]) is False:
row["node_id"] = get_nid_from_url_alias(config, row["node_id"])

node_endpoint = config["host"] + "/node/" + str(row["node_id"]) + "?_format=json"
node_headers = {"Content-Type": "application/json"}
# Make a GET request to the content type
content_type_endpoint = f"{config['host']}/entity/node_type/{config['content_type']}?_format=json"
Expand Down Expand Up @@ -852,11 +855,11 @@ def update():
"Node "
+ config["host"]
+ "/node/"
+ row["node_id"]
+ str(row["node_id"])
+ " updated."
)
logging.info(
"Node %s updated.", config["host"] + "/node/" + row["node_id"]
"Node %s updated.", config["host"] + "/node/" + str(row["node_id"])
)
else:
if config["progress_bar"] is False:
Expand Down
6 changes: 5 additions & 1 deletion workbench_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3906,7 +3906,11 @@ def deduplicate_field_values(values):

def get_node_field_values(config, nid):
"""Get a node's field data so we can use it during PATCH updates, which replace a field's values."""
node_url = config["host"] + "/node/" + nid + "?_format=json"

if value_is_numeric(nid) is False:
nid = get_nid_from_url_alias(config, nid)

node_url = config["host"] + "/node/" + str(nid) + "?_format=json"
response = issue_request(config, "GET", node_url)
node_fields = json.loads(response.text)
return node_fields
Expand Down

0 comments on commit d2f072e

Please sign in to comment.