-
Notifications
You must be signed in to change notification settings - Fork 118
Description
Description
I created a process with some optional inputs:
inputs = [LiteralInput('offset',
'Pagination offset',
data_type='integer',
default=0,
min_occurs=0)]
Running this in Apache/mod_wsgi, the apache log gives me:
[Tue Aug 16 12:03:11.269690 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] mod_wsgi (pid=11211): Exception occurred processing WSGI script '/var/www/html/wps/pywps.wsgi'.
[Tue Aug 16 12:03:11.269739 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] Traceback (most recent call last):
[Tue Aug 16 12:03:11.269761 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] File "/usr/local/lib/python2.7/dist-packages/Werkzeug-0.11.10-py2.7.egg/werkzeug/wrappers.py", line 291, in application
[Tue Aug 16 12:03:11.270088 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] return f(_args[:-2] + (request,))(_args[-2:])
[Tue Aug 16 12:03:11.270111 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] File "/usr/local/lib/python2.7/dist-packages/pywps-4.0.0a2-py2.7.egg/pywps/app/Service.py", line 585, in call
[Tue Aug 16 12:03:11.270238 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] request_uuid
[Tue Aug 16 12:03:11.270258 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] File "/usr/local/lib/python2.7/dist-packages/pywps-4.0.0a2-py2.7.egg/pywps/app/Service.py", line 304, in execute
[Tue Aug 16 12:03:11.270278 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] response = self._parse_and_execute(process, wps_request, uuid)
[Tue Aug 16 12:03:11.270293 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] File "/usr/local/lib/python2.7/dist-packages/pywps-4.0.0a2-py2.7.egg/pywps/app/Service.py", line 338, in _parse_and_execute
[Tue Aug 16 12:03:11.270313 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] inpt, wps_request.inputs[inpt.identifier])
[Tue Aug 16 12:03:11.270342 2016] [wsgi:error] [pid 11211:tid 140561246181120] [remote 127.0.0.1:42484] KeyError: 'offset'
It appears the parser is expecting an input for the offset parameter, but it's optional.
I was able to fix this with this simple change in the code:
diff --git a/pywps/app/Service.py b/pywps/app/Service.py
index 66b8843..67f10bf 100644
--- a/pywps/app/Service.py
+++ b/pywps/app/Service.py
@@ -330,7 +330,7 @@ class Service(object):
# Replace the dicts with the dict of Literal/Complex inputs
# set the input to the type defined in the process
- if isinstance(inpt, ComplexInput):
+ elif isinstance(inpt, ComplexInput):
data_inputs[inpt.identifier] = self.create_complex_inputs(
inpt, wps_request.inputs[inpt.identifier])
elif isinstance(inpt, LiteralInput):
Not sure if that was the intended behaviour or if there's more going on here...
Environment
- operating system: Ubuntu 16.04
- Python version: 2.7.12
- PyWPS version: 4.0.0-alpha2
- source/distribution
- git clone
- Debian
- PyPI
- zip/tar.gz
- other (please specify):
- web server
- Apache/mod_wsgi
- CGI
- other (please specify):