From ca69d5c3b52e6ff4e7aa7c7c7b5b8cbdeac612d7 Mon Sep 17 00:00:00 2001 From: Dennis <2rupnow@informatik.uni-hamburg.de> Date: Tue, 9 Apr 2019 12:56:26 +0200 Subject: [PATCH] logic change --- ckanext/odsh/controller.py | 5 ++--- ckanext/odsh/plugin.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/ckanext/odsh/controller.py b/ckanext/odsh/controller.py index 906afa0c..ac2c6d1f 100644 --- a/ckanext/odsh/controller.py +++ b/ckanext/odsh/controller.py @@ -166,10 +166,9 @@ class OdshFeedController(FeedController): class OdshAutocompleteController(ApiController): - def autocomplete(self): - from ckan.common import request + def autocomplete(self, q): query = { - 'spellcheck.q': request.get('q', ''), + 'spellcheck.q': q, 'wt': 'json'} conn = make_connection(decode_dates=False) diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py index 4f310eda..bb777f65 100644 --- a/ckanext/odsh/plugin.py +++ b/ckanext/odsh/plugin.py @@ -89,7 +89,7 @@ class OdshAutocompletePlugin(plugins.SingletonPlugin): def before_map(self, map): controller = 'ckanext.odsh.controller:OdshAutocompleteController' - map.connect('/autocomplete', controller=controller, action='autocomplete') + map.connect('/autocomplete?q={q}', controller=controller, action='autocomplete') return map -- GitLab