Hi,

I was wondering if its possible to handle errors returned from
http://wiki.pylonshq.com/display/pylonscookbook/A+Better+Way+To+Limit+File+Upload+Size

class LimitUploadSize(object):

    def __init__(self, app, size):
        self.app = app
        self.size = size

    def __call__(self, environ, start_response):
        req = Request(environ)
        if req.method=='POST'
            len = req.headers.get('Content-length')
            if not len:
                return HTTPBadRequest("No content-length header
specified")(environ, start_response)
            elif int(len) > self.size:
                return HTTPBadRequest("POST body exceeds maximum
limits")(environ, start_response)
        resp = req.get_response(self.app)
        return resp(environ, start_response)

using StatusCodeRedirect method?

Regards
P
--~--~---------~--~----~------------~-------~--~----~
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