def read_catalog_page(_format): if not _format: _format = check_access_header() if not _format: return index_endpoint() _profiles = toolkit.request.params.get('profiles') if _profiles: _profiles = _profiles.split(',') data_dict = { 'page': toolkit.request.params.get('page'), 'modified_since': toolkit.request.params.get('modified_since'), 'q': toolkit.request.params.get('q'), 'fq': toolkit.request.params.get('fq'), 'format': _format, 'profiles': _profiles, } try: response = toolkit.get_action('dcat_catalog_show')({}, data_dict) except (toolkit.ValidationError, RDFProfileException) as e: toolkit.abort(409, str(e)) if toolkit.check_ckan_version(max_version='2.8.99'): toolkit.response.headers.update( {'Content-type': CONTENT_TYPES[_format]}) else: from flask import make_response response = make_response(response) response.headers['Content-type'] = CONTENT_TYPES[_format] return response
def read_catalog(self, _format=None): if not _format: _format = check_access_header() if not _format: return index_endpoint() _profiles = toolkit.request.params.get('profiles') if _profiles: _profiles = _profiles.split(',') data_dict = { 'page': toolkit.request.params.get('page'), 'modified_since': toolkit.request.params.get('modified_since'), 'q': toolkit.request.params.get('q'), 'fq': toolkit.request.params.get('fq'), 'format': _format, 'profiles': _profiles, } toolkit.response.headers.update( {'Content-type': CONTENT_TYPES[_format]}) try: return toolkit.get_action('dcat_catalog_show')({}, data_dict) except (toolkit.ValidationError, RDFProfileException) as e: toolkit.abort(409, str(e))