Merge pull request #280 from NCAR/fix-html-link

Fix HTML view of ISO XML
This commit is contained in:
Adrià Mercader 2022-12-19 16:20:26 +01:00 committed by GitHub
commit 48e28e37f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -216,6 +216,13 @@ class TestHarvestedMetadataAPI(SpatialTestBase):
'<?xml version="1.0" encoding="UTF-8"?>\n<xml>Content 1</xml>'
)
# 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)

View File

@ -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