From 3de046365bcae8097706600fd2c8ef055bf98cdc Mon Sep 17 00:00:00 2001 From: CKAN User Date: Mon, 25 Apr 2022 21:07:05 +0000 Subject: [PATCH 1/2] Fix HTML view of ISO XML --- ckanext/spatial/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ckanext/spatial/util.py b/ckanext/spatial/util.py index 3aef1308..618bb94d 100644 --- a/ckanext/spatial/util.py +++ b/ckanext/spatial/util.py @@ -186,11 +186,11 @@ def get_harvest_object_content(id): return None -def _transform_to_html(content, xslt_package=None, xslt_path=None): +def transform_to_html(content, xslt_package=None, xslt_path=None): xslt_package = xslt_package or __name__ xslt_path = xslt_path or \ - '../templates/ckanext/spatial/gemini2-html-stylesheet.xsl' + 'templates/ckanext/spatial/gemini2-html-stylesheet.xsl' # optimise -- read transform only once and compile rather # than at each request From 6c607cf9bb9a7bc26e54eda73fe63ede348a6174 Mon Sep 17 00:00:00 2001 From: CKAN User Date: Tue, 26 Apr 2022 16:13:33 +0000 Subject: [PATCH 2/2] Add HTML test --- ckanext/spatial/tests/test_api.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ckanext/spatial/tests/test_api.py b/ckanext/spatial/tests/test_api.py index 2542a19f..42b60ad2 100644 --- a/ckanext/spatial/tests/test_api.py +++ b/ckanext/spatial/tests/test_api.py @@ -216,6 +216,13 @@ def test_api(self, app): '\nContent 1' ) + # Access human-readable view of content + url = "/harvest/object/{0}/html".format(object_id_1) + r = app.get(url, status=200) + assert( + r.headers["Content-Type"] == "text/html; charset=utf-8" + ) + # Access original content in object extra (if present) url = "/harvest/object/{0}/original".format(object_id_1) r = app.get(url, status=404)