diff --git a/ckanext/dcat/blueprints.py b/ckanext/dcat/blueprints.py index 44ab05d2..e7b14b19 100644 --- a/ckanext/dcat/blueprints.py +++ b/ckanext/dcat/blueprints.py @@ -22,7 +22,8 @@ def read_catalog(_format=None, package_type=None): def read_dataset(_id, _format=None, package_type=None): return utils.read_dataset_page(_id, _format) -if toolkit.asbool(config.get(utils.ENABLE_RDF_ENDPOINTS_CONFIG, True)): + +if utils.endpoints_enabled(): # requirements={'_format': 'xml|rdf|n3|ttl|jsonld'} dcat.add_url_rule(config.get('ckanext.dcat.catalog_endpoint', diff --git a/ckanext/dcat/plugins/__init__.py b/ckanext/dcat/plugins/__init__.py index 8a55da58..617e8d4b 100644 --- a/ckanext/dcat/plugins/__init__.py +++ b/ckanext/dcat/plugins/__init__.py @@ -80,6 +80,7 @@ def get_helpers(self): return { 'helper_available': utils.helper_available, 'dcat_get_endpoint': utils.get_endpoint, + 'dcat_endpoints_enabled': utils.endpoints_enabled, } # IActions diff --git a/ckanext/dcat/templates/package/read_base.html b/ckanext/dcat/templates/package/read_base.html index df6f3dea..6d2216f1 100644 --- a/ckanext/dcat/templates/package/read_base.html +++ b/ckanext/dcat/templates/package/read_base.html @@ -1,12 +1,16 @@ {% ckan_extends %} {% block links %} + {{ super() }} - {% with endpoint=h.dcat_get_endpoint('dataset') %} - - - - - {% endwith %} + + {% if h.dcat_endpoints_enabled() %} + {% with endpoint=h.dcat_get_endpoint('dataset') %} + + + + + {% endwith %} + {% endif %} {% endblock -%} {% block body_extras %} {{ super() }} diff --git a/ckanext/dcat/utils.py b/ckanext/dcat/utils.py index de0bf4b8..9500c87e 100644 --- a/ckanext/dcat/utils.py +++ b/ckanext/dcat/utils.py @@ -452,5 +452,9 @@ def read_catalog_page(_format): return response +def endpoints_enabled(): + return toolkit.asbool(config.get(ENABLE_RDF_ENDPOINTS_CONFIG, True)) + + def get_endpoint(_type='dataset'): return 'dcat.read_dataset' if _type == 'dataset' else 'dcat.read_catalog'