Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Dec 15, 2023
1 parent 6a9615c commit 0e7a836
Showing 1 changed file with 25 additions and 29 deletions.
54 changes: 25 additions & 29 deletions pygeoapi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1180,41 +1180,37 @@ def describe_collections(self, request: Union[APIRequest, Any],

try:
edr = get_provider_by_type(v['providers'], 'edr')
p = load_plugin('provider', edr)
except ProviderConnectionError:
msg = 'connection error (check logs)'
return self.get_exception(
HTTPStatus.INTERNAL_SERVER_ERROR, headers,
request.format, 'NoApplicableCode', msg)
except ProviderTypeError:
edr = None

if edr:
# TODO: translate
LOGGER.debug('Adding EDR links')
try:
p = load_plugin('provider', get_provider_by_type(
self.config['resources'][dataset]['providers'], 'edr'))
parameters = p.get_fields()
if parameters:
collection['parameter-names'] = {}
for f in parameters['field']:
collection['parameter-names'][f['id']] = f

for qt in p.get_query_types():
collection['links'].append({
'type': 'application/json',
'rel': 'data',
'title': f'{qt} query for this collection as JSON',
'href': f'{self.get_collections_url()}/{k}/{qt}?f={F_JSON}' # noqa
})
collection['links'].append({
'type': FORMAT_TYPES[F_HTML],
'rel': 'data',
'title': f'{qt} query for this collection as HTML',
'href': f'{self.get_collections_url()}/{k}/{qt}?f={F_HTML}' # noqa
})
except ProviderConnectionError:
msg = 'connection error (check logs)'
return self.get_exception(
HTTPStatus.INTERNAL_SERVER_ERROR, headers,
request.format, 'NoApplicableCode', msg)
except ProviderTypeError:
pass
parameters = p.get_fields()
if parameters:
collection['parameter-names'] = {}
for f in parameters['field']:
collection['parameter-names'][f['id']] = f

for qt in p.get_query_types():
collection['links'].append({
'type': 'application/json',
'rel': 'data',
'title': f'{qt} query for this collection as JSON',
'href': f'{self.get_collections_url()}/{k}/{qt}?f={F_JSON}' # noqa
})
collection['links'].append({
'type': FORMAT_TYPES[F_HTML],
'rel': 'data',
'title': f'{qt} query for this collection as HTML',
'href': f'{self.get_collections_url()}/{k}/{qt}?f={F_HTML}' # noqa
})

if dataset is not None and k == dataset:
fcm = collection
Expand Down

0 comments on commit 0e7a836

Please sign in to comment.