Improve resolving local groups

Improve resolving local groups by searching for group additionally by name.
This commit is contained in:
seitenbau-govdata 2016-11-15 22:38:27 +01:00 committed by GitHub
parent b78afd0302
commit 0f951d9fc0
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: