Pylons: __call__ and abort(), error code 500 instead of requested code
I'm trying to use pylons.controllers.utils.abort() function to terminate ap开发者_如何学Pythonplication and return corresponding code to the browser. But the only returning code is 500 Internal Server Error if calling from controller's method call(). For example
class ApiController(WSGIController):
def __call__(self, environ, start_response):
abort(411)
What should I change to get normal server response with code 411?
Edit: Nevermind, looks like abort()
is not supposed to be used in the __call__()
method.
abort()
is not working properly there so I'm using this code now:
return HTTPBadRequest()(environ, start_response)
精彩评论