Skip to content
Merged
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
11 changes: 4 additions & 7 deletions pywps/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"""


from werkzeug.wrappers import Response
from werkzeug.exceptions import HTTPException
from werkzeug._compat import text_type
from werkzeug.utils import escape
Expand Down Expand Up @@ -50,20 +51,15 @@ def name(self):
"""The status name."""
return self.__class__.__name__

def get_headers(self, environ=None):
"""Get a list of headers."""
return [('Content-Type', 'text/xml')]

def get_description(self, environ=None):
"""Get the description."""
if self.description:
return '''<ows:ExceptionText>%s</ows:ExceptionText>''' % escape(self.description)
else:
return ''

def get_body(self, environ=None):
"""Get the XML body."""
return text_type((
def get_response(self, environ=None):
doc = text_type((
u'<?xml version="1.0" encoding="UTF-8"?>\n'
u'<!-- PyWPS %(version)s -->\n'
u'<ows:ExceptionReport xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd" version="1.0.0">\n' # noqa
Expand All @@ -78,6 +74,7 @@ def get_body(self, environ=None):
'name': escape(self.name),
'description': self.get_description(environ)
})
return Response(doc, self.code, mimetype='text/xml')


class InvalidParameterValue(NoApplicableCode):
Expand Down