Skip to content

Commit

Permalink
fix: missing SRS records triggered bug
Browse files Browse the repository at this point in the history
Can't do "in foo" if foo is None. Duh.
  • Loading branch information
mhucka committed Jun 8, 2024
1 parent ae22a53 commit 104e7a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions foliage/delete_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,10 @@ def srs_response_converter(response):

srsget = f'/source-storage/records/{instance.id}/formatted?idType=INSTANCE'
data_json = folio.request(srsget, converter = srs_response_converter)
if data_json and 'matchedId' in data_json:
if not data_json:
flagged(instance, ("FOLIO SRS lacks a corresponding record; therefore, "
" only the instance record will be deleted"))
elif data_json.get('matchedId'):
srs_id = data_json["id"]
if config('DEMO_MODE', cast = bool):
log(f'demo mode in effect – pretending to delete {srs_id} from SRS')
Expand All @@ -301,12 +304,9 @@ def srs_response_converter(response):
failed(instance, str(ex), why)
return False
succeeded(instance, f'removed SRS instance record **{srs_id}**', why)
elif 'matchedId' not in data_json:
else:
failed(instance, 'unexpected data from FOLIO SRS – please report this')
return
else:
flagged(instance, ("FOLIO SRS lacks a corresponding record, therefore"
" only the instance record will be deleted"))

# Deletions on instances are not recursive regardless of which API you use.
# You have to manually remove items, then holdings, then instances.
Expand Down

0 comments on commit 104e7a9

Please # to comment.