Skip to content

Commit 7ce6abd

Browse files
committed
fix: datacite rights should pull out name as well as url
1 parent 7a8ed50 commit 7ce6abd

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

codemeticulous/datacite/convert.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,17 @@ def codemeta_license_to_datacite_rights(
294294
# plain string licenses should always be urls
295295
if isinstance(l, str) and is_url(l):
296296
license_url = l
297-
elif hasattr(l, "url") and is_url(l.url):
298-
license_url = l.url
299-
elif hasattr(l, "name"):
300-
license_name = l.name
297+
else:
298+
if hasattr(l, "url") and is_url(l.url):
299+
license_url = l.url
300+
if hasattr(l, "name"):
301+
license_name = l.name
301302
# FIXME: build a lookup table for spdx/osi licenses so we can figure out
302303
# what license is being used and fill out all fields
303-
rights_list.append(RightsListItem(rights=license_name, rightsUri=license_url))
304+
if license_name or license_url:
305+
rights_list.append(
306+
RightsListItem(rights=license_name, rightsUri=license_url)
307+
)
304308
return rights_list or None
305309

306310

0 commit comments

Comments
 (0)