From e9c085dd11d72681533459ca302c58c065cb5a19 Mon Sep 17 00:00:00 2001
From: Thorge Petersen <petersen@rz.uni-kiel.de>
Date: Wed, 10 May 2023 13:32:07 +0200
Subject: [PATCH] is_url and url_for from ckan helpers

---
 ckanext/odsh/collection/plugin.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/ckanext/odsh/collection/plugin.py b/ckanext/odsh/collection/plugin.py
index 6b196f12..501f5cad 100644
--- a/ckanext/odsh/collection/plugin.py
+++ b/ckanext/odsh/collection/plugin.py
@@ -1,6 +1,7 @@
 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)
 
-- 
GitLab