From b9bd7feb0a0461e3bb525ec91d4dafd7307a25cd Mon Sep 17 00:00:00 2001 From: anonymous <anonymous> Date: Wed, 3 Apr 2019 13:00:00 +0200 Subject: [PATCH] init autocomplete --- ckanext/odsh/controller.py | 13 ++++++++++++- ckanext/odsh/plugin.py | 10 ++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ckanext/odsh/controller.py b/ckanext/odsh/controller.py index 34b7eeeb..288c2392 100644 --- a/ckanext/odsh/controller.py +++ b/ckanext/odsh/controller.py @@ -19,6 +19,7 @@ from ckanext.dcat.controllers import DCATController abort = base.abort log = logging.getLogger(__name__) + class OdshRouteController(HomeController): def info_page(self): h.redirect_to('http://www.schleswig-holstein.de/odpinfo') @@ -27,6 +28,7 @@ class OdshRouteController(HomeController): def not_found(self): abort(404) + class OdshUserController(UserController): def me(self, locale=None): if not c.user: @@ -63,9 +65,11 @@ class OdshUserController(UserController): abort(404) return super(OdshUserController,self).activity(id, offset) + class OdshPackageController(PackageController): pass + class OdshApiController(ApiController): def action(self, logic_function, ver=None): try: @@ -90,12 +94,14 @@ class OdshApiController(ApiController): log.error(e) return ApiController.action(self, logic_function, ver) - + + class OdshDCATController(DCATController): def read_catalog(self, _format): matomo.create_matomo_request() return DCATController.read_catalog(self,_format) + class OdshFeedController(FeedController): def custom(self): matomo.create_matomo_request() @@ -153,3 +159,8 @@ class OdshFeedController(FeedController): feed_guid=_create_atom_id(atom_url), feed_url=feed_url, navigation_urls=navigation_urls) + + +class OdshAutocompleteController(ApiController): + def autocomplete(self): + base.response.body_file.write("Hello World") diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py index 0e511035..e2eb198c 100644 --- a/ckanext/odsh/plugin.py +++ b/ckanext/odsh/plugin.py @@ -76,12 +76,22 @@ def remove_route(map,routename): map._routenames.pop(route.name) break + class OdshIcapPlugin(plugins.SingletonPlugin): plugins.implements(plugins.IUploader, inherit=True) def get_resource_uploader(self, data_dict): return ODSHResourceUpload(data_dict) + +class OdshAutocompletePlugin(plugins.SingletonPlugin): + plugins.implements(plugins.IRoutes, inherit=True) + + def before_map(self, map): + controller = 'ckanext.odsh.controller:OdshAutocompleteController' + map.connect('/autocomplete', controller=controller, action='autocomplete') + + class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm): plugins.implements(plugins.IConfigurer) plugins.implements(plugins.ITemplateHelpers) -- GitLab