Skip to content

Commit

Permalink
oai: fix error on document type processing
Browse files Browse the repository at this point in the history
* Closes #789.

Co-Authored-by: Bertrand Zuchuat <bertrand.zuchuat@rero.ch>
  • Loading branch information
Garfield-fr committed Mar 2, 2022
1 parent 43ada69 commit bdc83d1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions sonar/modules/documents/serializers/schemas/dc.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,9 @@ def get_titles(self, obj):

def get_types(self, obj):
"""Get types."""
if obj['metadata'].get('documentType'):
return [
'http://purl.org/coar/resource_type/{type}'.format(
type=obj['metadata']['documentType'].split(':')[1])
]
types = obj['metadata'].get('documentType', '').split(':')
if len(types) == 2:
return [f'http://purl.org/coar/resource_type/{types[1]}']

return []

Expand Down

0 comments on commit bdc83d1

Please sign in to comment.