Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pygeoapi/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,17 +662,17 @@ def landing_page(api: API,
'rel': request.get_linkrel(F_JSON),
'type': FORMAT_TYPES[F_JSON],
'title': l10n.translate('This document as JSON', request.locale),
'href': f"{api.base_url}?f={F_JSON}"
'href': f"{api.base_url}/?f={F_JSON}"
}, {
'rel': request.get_linkrel(F_JSONLD),
'type': FORMAT_TYPES[F_JSONLD],
'title': l10n.translate('This document as RDF (JSON-LD)', request.locale), # noqa
'href': f"{api.base_url}?f={F_JSONLD}"
'href': f"{api.base_url}/?f={F_JSONLD}"
}, {
'rel': request.get_linkrel(F_HTML),
'type': FORMAT_TYPES[F_HTML],
'title': l10n.translate('This document as HTML', request.locale),
'href': f"{api.base_url}?f={F_HTML}",
'href': f"{api.base_url}/?f={F_HTML}",
'hreflang': api.default_locale
}, {
'rel': 'service-desc',
Expand Down
4 changes: 2 additions & 2 deletions pygeoapi/api/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ def gen_collection(api, request, dataset: str,
'type': FORMAT_TYPES[F_JSON],
'rel': 'root',
'title': l10n.translate('The landing page of this server as JSON', locale_), # noqa
'href': f"{api.base_url}?f={F_JSON}"
'href': f"{api.base_url}/?f={F_JSON}"
}, {
'type': FORMAT_TYPES[F_HTML],
'rel': 'root',
'title': l10n.translate('The landing page of this server as HTML', locale_), # noqa
'href': f"{api.base_url}?f={F_HTML}"
'href': f"{api.base_url}/?f={F_HTML}"
}, {
'type': FORMAT_TYPES[F_JSON],
'rel': request.get_linkrel(F_JSON),
Expand Down
4 changes: 2 additions & 2 deletions pygeoapi/api/itemtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,12 +956,12 @@ def get_collection_item(api: API, request: APIRequest,
'type': FORMAT_TYPES[F_JSON],
'rel': 'root',
'title': l10n.translate('The landing page of this server as JSON', request.locale), # noqa
'href': f"{api.base_url}?f={F_JSON}"
'href': f"{api.base_url}/?f={F_JSON}"
}, {
'type': FORMAT_TYPES[F_HTML],
'rel': 'root',
'title': l10n.translate('The landing page of this server as HTML', request.locale), # noqa
'href': f"{api.base_url}?f={F_HTML}"
'href': f"{api.base_url}/?f={F_HTML}"
}, {
'rel': request.get_linkrel(F_JSON),
'type': 'application/geo+json',
Expand Down
28 changes: 13 additions & 15 deletions pygeoapi/api/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,13 @@ def get_jobs(api: API, request: APIRequest,
if JobStatus[job_['status']] in (
JobStatus.successful, JobStatus.running, JobStatus.accepted):

job_result_url = f"{api.base_url}/jobs/{job_['identifier']}/results" # noqa
job_result_url = f"{api.base_url}/jobs/{job_['identifier']}/results?f={F_JSON}" # noqa

job2['links'] = [{
'href': job_result_url,
'rel': 'http://www.opengis.net/def/rel/ogc/1.0/results',
'type': job_['mimetype'],
'title': f"Results of job {job_id} as {job_['mimetype']}"
'title': f"Results of job {job_['identifier']} as {job_['mimetype']}" # noqa
}]

serialized_jobs['jobs'].append(job2)
Expand Down Expand Up @@ -592,20 +592,18 @@ def get_job_result(api: API, request: APIRequest,
if mimetype not in (None, FORMAT_TYPES[F_JSON]):
headers['Content-Type'] = mimetype
content = job_output
elif request.format == F_HTML:
headers['Content-Type'] = "text/html"
data = {
'job': {'id': job_id},
'result': job_output
}
content = render_j2_template(
api.config, api.config['server']['templates'],
'jobs/results/index.html', data, request.locale)
else:
if request.format == F_JSON:
content = json.dumps(job_output, sort_keys=True, indent=4,
default=json_serial)
else:
# HTML
headers['Content-Type'] = "text/html"
data = {
'job': {'id': job_id},
'result': job_output
}
content = render_j2_template(
api.config, api.config['server']['templates'],
'jobs/results/index.html', data, request.locale)
content = json.dumps(job_output, sort_keys=True, indent=4,
default=json_serial)

return headers, HTTPStatus.OK, content

Expand Down
2 changes: 0 additions & 2 deletions pygeoapi/provider/xarray_.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,6 @@ def gen_covjson(self, metadata, data, fields):
self, selected_fields
)

data = data.fillna(None)

try:
for key, value in selected_fields.items():
LOGGER.debug(f'Adding range {key}')
Expand Down
6 changes: 3 additions & 3 deletions tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,10 @@ def test_root(config, api_):
assert root['links'][0]['href'] == 'http://example.org'
assert root['links'][1]['rel'] == 'self'
assert root['links'][1]['type'] == FORMAT_TYPES[F_JSON]
assert root['links'][1]['href'].endswith('?f=json')
assert any(link['href'].endswith('f=jsonld') and link['rel'] == 'alternate'
assert root['links'][1]['href'].endswith('/?f=json')
assert any(link['href'].endswith('/?f=jsonld') and link['rel'] == 'alternate' # noqa
for link in root['links'])
assert any(link['href'].endswith('f=html') and link['rel'] == 'alternate'
assert any(link['href'].endswith('/?f=html') and link['rel'] == 'alternate' # noqa
for link in root['links'])
assert len(root['links']) == 13
assert 'title' in root
Expand Down