Chris schrieb: > We are creating a web service using Pyons that uses XML as the primary > response content type. We have had some trouble when using abort() > because it raises a webob.exc.WSGIHTTPException which has a HTML > response as it's default body. > > The workaround we have implemented overrides _inspect_call() in > base.py like this > > def _inspect_call(self, func): > result = super(BaseController, self)._inspect_call(func) > if hasattr(result,'empty_body'): > result.empty_body = True > > return result > > > Perhaps it should be the default to always set empty_body to True when > a WSGIHTTPException is raised or when it is caught.
I would like to chime in because I have a similar problem. When a user requests an image in my application that isn't available then I'd like to return a dummy image along with an HTTP response code 404. But as soon as I set the status to 404 or even abort(404) then no matter what I try I always get an HTTP response. Overriding functions isn't really my preferred way here either. It's one of the few occassions where the framework got in my way. :) Cheers Christoph
signature.asc
Description: OpenPGP digital signature