diff --git a/pywps/exceptions.py b/pywps/exceptions.py index e174de422..0babfcff5 100644 --- a/pywps/exceptions.py +++ b/pywps/exceptions.py @@ -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 @@ -50,10 +51,6 @@ 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: @@ -61,9 +58,8 @@ def get_description(self, environ=None): 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'\n' u'\n' u'\n' # noqa @@ -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):