Skip to content
Snippets Groups Projects
Commit e9c085dd authored by Thorge Petersen's avatar Thorge Petersen
Browse files

is_url and url_for from ckan helpers

parent ca3b026b
Branches
Tags
2 merge requests!41Version 2.0.0,!38Merge py3 into dev
from ckan.lib.plugins import DefaultDatasetForm
import ckan.plugins as plugins
import ckan.plugins.toolkit as toolkit
from ckan.lib.helpers import is_url, url_for
from . import helpers as collection_helpers
from flask import Blueprint
......@@ -61,14 +62,14 @@ class CollectionsPlugin(plugins.SingletonPlugin, DefaultDatasetForm):
download_package_id = latest_resources.get('package_id')
download_resource_id = latest_resources.get('id')
pre_resource_url = latest_resources.get('url')
if toolkit.is_url(pre_resource_url):
if is_url(pre_resource_url):
url_resource = pre_resource_url
else:
url_resource = toolkit.url_for(named_route='dataset.resource_download',
url_resource = url_for(named_route='dataset.resource_download',
id=download_package_id,
resource_id=download_resource_id,
filename=pre_resource_url)
toolkit.redirect_to(url_resource)
return toolkit.redirect_to(url_resource)
else:
toolkit.abort(404)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment