Skip to content

Commit

Permalink
Set dict key to lowercase for easier comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
MTachon committed Aug 11, 2023
1 parent 91249cc commit 083ac3f
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions pygeoapi/provider/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,21 +103,24 @@ def __init__(self, provider_def):
}
)
for f in self._format_config['supported_output_formats']:
self._format_options[f['name']] = f['options']
self._format_mimetype[f['name']] = f['mimetype']
self._format_options[f['name'].lower()] = f['options']
self._format_mimetype[f['name'].lower()] = f['mimetype']
self._supported_output_formats.append(f['name'])
else:
storage_format_config = provider_def.get('format', dict())
if storage_format_config:
fmt_name = storage_format_config['name']
fmt_mimetype = storage_format_config['mimetype']
fmt_options = provider_def.get('options')
self._format_config = {
'storage': {
'name': fmt_name,
'mimetype': storage_format_config['mimetype'],
'options': provider_def.get('options'),
'mimetype': fmt_mimetype,
'options': fmt_options,
},
}

self._format_mimetype[fmt_name.lower()] = fmt_mimetype
self._format_options[fmt_name.lower()] = fmt_options
self._supported_output_formats.append(fmt_name)
else:
self._format_config = {'storage': dict()}
Expand All @@ -143,12 +146,12 @@ def mimetype(self):
def get_format_options(self, fmt_name):
"""Get the options for a given output format
"""
return self._format_options[fmt_name]
return self._format_options[fmt_name.lower()]

def get_format_mimetype(self, fmt_name):
"""Get the mimetype for a given output format
"""
return self._format_mimetype[fmt_name]
return self._format_mimetype[fmt_name.lower()]

@property
def supported_output_formats(self):
Expand Down

0 comments on commit 083ac3f

Please sign in to comment.