From d518b6709af2c8dd423c39fd8eecc75faf6241d4 Mon Sep 17 00:00:00 2001 From: joetsoi Date: Thu, 21 Mar 2013 11:54:02 +0000 Subject: [PATCH] [#27] fix package_list_for_source for unowned data sources --- ckanext/harvest/helpers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ckanext/harvest/helpers.py b/ckanext/harvest/helpers.py index 6976bfb..5c16481 100644 --- a/ckanext/harvest/helpers.py +++ b/ckanext/harvest/helpers.py @@ -28,10 +28,12 @@ def package_list_for_source(source_id): context = {'model': model, 'session': model.Session} - user_member_of_orgs = [org['id'] for org + owner_org = p.toolkit.c.harvest_source.get('owner_org', '') + if owner_org: + user_member_of_orgs = [org['id'] for org in h.organizations_available('read')] - if (p.toolkit.c.harvest_source and p.toolkit.c.harvest_source['owner_org'] in user_member_of_orgs): - context['ignore_capacity_check'] = True + if (p.toolkit.c.harvest_source and owner_org in user_member_of_orgs): + context['ignore_capacity_check'] = True query = logic.get_action('package_search')(context, search_dict)