Skip to content

Commit

Permalink
fix local use of datastore api without try, except
Browse files Browse the repository at this point in the history
  • Loading branch information
wardi committed Oct 31, 2013
1 parent 86dea6c commit 129aec8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ckanext/datastore/db.py
Expand Up @@ -834,11 +834,12 @@ def _insert_links(data_dict, limit, offset):
and the resource page.'''
data_dict['_links'] = {}

# no links required for local actions
if not toolkit.request.environ:
return

# get the url from the request
try:
urlstring = toolkit.request.environ['CKAN_CURRENT_URL']
except TypeError:
return # no links required for local actions
urlstring = toolkit.request.environ['CKAN_CURRENT_URL']

# change the offset in the url
parsed = list(urlparse.urlparse(urlstring))
Expand Down

0 comments on commit 129aec8

Please sign in to comment.