Skip to content

Commit

Permalink
Munge group name before fetching remote group
Browse files Browse the repository at this point in the history
The API call /api/2/rest/package/<id> returns the display name of the
group instead of its ID. To properly match the group, munge the name
before calling /api/2/rest/group
  • Loading branch information
Stefan Oderbolz committed Jan 14, 2015
1 parent ef35c21 commit 935b9dd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ckanext/harvest/harvesters/ckanharvester.py
Expand Up @@ -5,6 +5,7 @@
from ckan.model import Session, Package
from ckan.logic import ValidationError, NotFound, get_action
from ckan.lib.helpers import json
from ckan.lib.munge import munge_name

from ckanext.harvest.model import HarvestJob, HarvestObject, HarvestGatherError, \
HarvestObjectError
Expand Down Expand Up @@ -51,7 +52,7 @@ def _get_content(self, url):
return http_response.read()

def _get_group(self, base_url, group_name):
url = base_url + self._get_rest_api_offset() + '/group/' + group_name
url = base_url + self._get_rest_api_offset() + '/group/' + munge_name(group_name)
try:
content = self._get_content(url)
return json.loads(content)
Expand Down

0 comments on commit 935b9dd

Please sign in to comment.