Merge pull request #270 from GovDataOfficial/improve-resolving-local-groups

Improve resolving local groups
This commit is contained in:
Adrià Mercader 2017-03-01 12:29:29 +00:00 committed by GitHub
commit e3b4854b07
1 changed files with 14 additions and 2 deletions

View File

@ -428,8 +428,20 @@ class CKANHarvester(HarvesterBase):
for group_ in package_dict['groups']:
try:
data_dict = {'id': group_['id']}
group = get_action('group_show')(base_context.copy(), data_dict)
try:
if 'id' in group_:
data_dict = {'id': group_['id']}
group = get_action('group_show')(base_context.copy(), data_dict)
else:
raise NotFound
except NotFound, e:
if 'name' in group_:
data_dict = {'id': group_['name']}
group = get_action('group_show')(base_context.copy(), data_dict)
else:
raise NotFound
# Found local group
validated_groups.append({'id': group['id'], 'name': group['name']})
except NotFound, e: