Hi,

When an exception occurs in my application I want to ba able to set
the response code and return a specific response body. I can set the
response without a problem but Pylons seems to be overriding the
response code and returns a 200 instead.

Here's my code snippet:

class MyController(BaseController)
    def index(self):
        result = {}
        try:  # try-except
            result["result"] = func(*args, **kwargs)
        except (KeyError, ValueError), e:
            response.status = 400
            result["error"] = str(e)
        except Exception, e:
            response.status = 500
            result["error"] = str(e)
        finally:
            return result

I've read through the pylons docs on the wiki, but I can only find
references to an abort() method which sets the response code but
doesn't allow me to set the body. Any suggestions or pointers where I
can look for more information

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to