From 53a9ff21b2f3f93dc44b3ec8ef38b94768d84f5d Mon Sep 17 00:00:00 2001 From: Samuele Santi Date: Fri, 6 Dec 2013 16:42:20 +0100 Subject: [PATCH] Prevent failure in case no record is found (empty database) (fixes #1363) --- ckan/logic/action/get.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ckan/logic/action/get.py b/ckan/logic/action/get.py index 21612765a48..497d8468481 100644 --- a/ckan/logic/action/get.py +++ b/ckan/logic/action/get.py @@ -105,7 +105,9 @@ def package_list(context, data_dict): offset = data_dict.get('offset') if offset: query = query.offset(offset) - return list(zip(*query.execute())[0]) + + ## Returns the first field in each result record + return [r[0] for r in query.execute()] def current_package_list_with_resources(context, data_dict): '''Return a list of the site's datasets (packages) and their resources.