Skip to content

Commit

Permalink
Issue #7. The service and request parameters are now case-insensitive.
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Haesler committed May 31, 2018
1 parent a5bb2e0 commit 8e33b20
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions datacube_wms/wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,24 @@ def lower_get_args():
@app.route('/')
def wms_impl():
nocase_args = lower_get_args()
operation = nocase_args.get("request")
service = nocase_args.get("service","").upper()
operation = nocase_args.get("request", "").upper()
try:
if not operation:
raise WMSException("No operation specified", locator="Request parameter")
elif operation == "GetCapabilities":
return get_capabilities(nocase_args)
elif operation == "GetMap":
return get_map(nocase_args)
elif operation == "GetFeatureInfo":
return feature_info(nocase_args)
if service == "WMS":
# WMS operation Map
if not operation:
raise WMSException("No operation specified", locator="Request parameter")
elif operation == "GETCAPABILITIES":
return get_capabilities(nocase_args)
elif operation == "GETMAP":
return get_map(nocase_args)
elif operation == "GETFEATUREINFO":
return feature_info(nocase_args)
else:
raise WMSException("Unrecognised operation: %s" % operation, WMSException.OPERATION_NOT_SUPPORTED,
"Request parameter")
else:
raise WMSException("Unrecognised operation: %s" % operation, WMSException.OPERATION_NOT_SUPPORTED,
"Request parameter")
raise WMSException("Invalid service", locator="Service parameter")
except WMSException as e:
return wms_exception(e)
except Exception as e:
Expand All @@ -59,8 +64,6 @@ def test_client():


def get_capabilities(args):
if args.get("service") != "WMS":
raise WMSException("Invalid service", locator="Service parameter")
# TODO: Handle updatesequence request parameter for cache consistency.
# Note: Only WMS v1.3.0 is fully supported at this stage, so no version negotiation is necessary
# Extract layer metadata from Datacube.
Expand Down

0 comments on commit 8e33b20

Please sign in to comment.