Skip to content

Commit

Permalink
serializers: fix error when no bf:Publication
Browse files Browse the repository at this point in the history
* When no `provisionActivity` of type `bf:publication` is present,
the collector returns None rather than an empty generator.
* Fixes RT 412.
* Fixes Sentry RERO-ILS-2D1.

Co-Authored-by: Pascal Repond <[email protected]>
Co-Authored-by: Renaud Michotte <[email protected]>
  • Loading branch information
PascalRepond and zannkukai committed Oct 17, 2022
1 parent 1b361ca commit c45b40d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rero_ils/modules/items/serializers/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ def _build_doc(data):
# process provision activity
provision_activity = next(
filter(lambda x: x.get('type')
== 'bf:Publication', data.get('provisionActivity'))
== 'bf:Publication', data.get('provisionActivity'),
None)
)
start_date = provision_activity.get('startDate', '')
end_date = provision_activity.get('endDate')
Expand Down

0 comments on commit c45b40d

Please sign in to comment.