Skip to content

Commit 1159cd1

Browse files
committed
entities: fix replace identified by
Co-Authored-by: Peter Weber <[email protected]>
1 parent 41819da commit 1159cd1

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

rero_ils/modules/entities/replace.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ def _get_latest(self, entity_type, source, pid):
9393
if res.status_code == requests.codes.ok:
9494
data = res.json()
9595
# TODO: could be deleted if MEF is updated.
96-
if data_type := data.get('bf:Agent', data.get('type')):
97-
data['type'] = data_type
98-
elif entity_type == 'concepts':
99-
data['type'] = 'bf:Topic'
96+
# If we have a latest record add type to the data.
97+
if data:
98+
if data_type := data.get('bf:Agent', data.get('type')):
99+
data['type'] = data_type
100+
elif entity_type == 'concepts':
101+
data['type'] = 'bf:Topic'
100102
return data
101103
self.logger.warning(f'Problem get {url}: {res.status_code}')
102104
return {}

0 commit comments

Comments
 (0)