Originally we were planning to get round this problem by just changing error_document_template in the error controller to be XML rarther than HTML. This is no good in our case because we have custom XML schema validation middleware that rejects the response object created by abort () before it gets to the statusCodeRedirect middleware. Perhaps this approach could help you. I am making the assumption that you have mistaken where the HTML is coming from, if this is incorrect I am sorry.
On Sep 30, 3:56 pm, Christoph Haas <em...@christoph-haas.de> wrote: > 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 > < 1KViewDownload --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en -~----------~----~----~----~------~----~------~--~---