diff --git a/ckanext/odsh/controller.py b/ckanext/odsh/controller.py index dd68bdd3f3d8cbea7d0400f494915edf738c44f5..e0d051826fcae626ff164d68a2f67288bf02c2fc 100644 --- a/ckanext/odsh/controller.py +++ b/ckanext/odsh/controller.py @@ -28,46 +28,6 @@ render = base.render get_action = logic.get_action -class OdshApiController(ApiController): - def action(self, logic_function, ver=None): - if toolkit.asbool(config.get('ckanext.odsh.log_api_requests', 'false')): - try: - request_data = self._get_request_data(try_url_params=False) - log.info('POST request body: {}'.format(request_data)) - except Exception as e: - log.error(e) - if logic_function == 'resource_qv4yAI2rgotamXGk98gJ': - return helpers.odsh_get_version_id() - if logic_function == 'resourcelog_qv4yAI2rgotamXGk98gJ': - if config.get('ckanext.odsh.enabletestendpoints', None) == 'True': - log.info('This is an info test log') - log.warning('This is an warning test log') - log.error('This is an error test log') - return 'ok' - try: - function = logic.get_action(logic_function) - side_effect_free = getattr(function, 'side_effect_free', False) - request_data = self._get_request_data( - try_url_params=side_effect_free) - if isinstance(request_data, dict): - id = request_data.get('id', '') - if 'q' in request_data: - id = request_data['q'] - if 'query' in request_data: - id = request_data['query'] - userid = None - if c.user: - userid = hashlib.md5(c.user).hexdigest()[:16] - # matomo.create_matomo_request(userid) - #else: - # matomo.create_matomo_request() - - except Exception as e: - log.error(e) - - return ApiController.action(self, logic_function, ver) - - class OdshFeedController(FeedController): def custom(self): extra_fields = ['ext_startdate', 'ext_enddate', diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py index 3e7acd93942f2089ba05786fb7006d1d7c978fe2..4ce7a2a46eb9a44c06df382afeb9ebc64eebef66 100644 --- a/ckanext/odsh/plugin.py +++ b/ckanext/odsh/plugin.py @@ -294,20 +294,10 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm map.redirect('/dataset/{id}/resource/{resource_id}', '/dataset/{id}') - # /api ver 3 - GET_POST = dict(method=['GET', 'POST']) - with SubMapper( - map, - controller='ckanext.odsh.controller:OdshApiController', - path_prefix='/api{ver:/3|}', - ver='/3' - ) as m: - m.connect('/action/{logic_function}', - action='action', conditions=GET_POST) - with SubMapper(map, controller='ckanext.odsh.controller:OdshFeedController') as m: m.connect('/feeds/custom.atom', action='custom') + # redirect all user routes to custom controller # with SubMapper(map, controller='ckanext.odsh.controller:OdshUserController') as m: # m.connect('/user/edit', action='edit')