diff --git a/ckanext/odsh/collection/helpers.py b/ckanext/odsh/collection/helpers.py index f3b4e73dba5e0926579d6c947075ab93c7b8416a..c4f4496f38074d218c95fe6ec12107638a230c85 100644 --- a/ckanext/odsh/collection/helpers.py +++ b/ckanext/odsh/collection/helpers.py @@ -156,4 +156,6 @@ def get_latest_resources_for_format(collection_name, resource_format): return None resources_with_asked_type = [r for r in resources if r.get('format').upper() == resource_format.upper()] resources_sorted = sorted(resources_with_asked_type, key=itemgetter('id','created'), reverse=True) + if len(resources_sorted) == 1: + return None return resources_sorted[-1]