Skip to content

Commit c2e3b3b

Browse files
committed
update delete_item function to use Item instead of item_uuid
1 parent 72c29da commit c2e3b3b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

dspace_rest_client/client.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,17 +1420,20 @@ def add_metadata(
14201420

14211421
return dso_type(api_resource=parse_json(r))
14221422

1423-
def delete_item(self, item_uuid):
1423+
def delete_item(self, item):
14241424
"""
14251425
Delete an item, given its UUID
14261426
@param item_uuid: the UUID of the item
14271427
@return: the raw API response
14281428
"""
14291429
try:
1430-
url = f"{self.API_ENDPOINT}/core/items/{item_uuid}"
1430+
if not isinstance(item, Item):
1431+
logging.error("Need a valid item")
1432+
return None
1433+
url = f"{self.API_ENDPOINT}/core/items/{item.uuid}"
14311434
return self.api_delete(url)
14321435
except ValueError:
1433-
logging.error("Invalid item UUID: %s", item_uuid)
1436+
logging.error("Invalid item UUID: %s", item.uuid)
14341437
return None
14351438

14361439
def create_user(self, user, token=None, embeds=None):

0 commit comments

Comments
 (0)