I've inserted a simple middleware class into my wsgi stack and
suddenly the POST dictionary is empty when handling a file upload form
submission.
class MyMiddleware(object):
def __init__
(self,app,config=None,environ_key='my.stuff',**kwargs):
self.app = app
def __call__(self, environ, start_response):
req = Request(environ)
log().info("handling request %s" % req)
log().info("request.POST= %s" % req.POST)
resp = req.get_response(self.app)
return resp(environ, start_response)
I've appended the log output when a file upload post goes by, showing
the request headers and body. Why's the POST dict not being populated
with the upload and case_number variables? The self.app/controller
throws a KeyError during get_response(). This controller works fine
when the middleware is not there.
Logfile output from the above:
2009-05-15 12:45:31 INFO handling request POST /testform
Accept: text/xml,application/xml,application/xhtml+xml,text/
html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Encoding: gzip, deflate
Accept-Language: en-us
Cache-Control: max-age=0
Connection: keep-alive
Content-Length: -1
Content-Type: multipart/form-data; boundary=----
WebKitFormBoundaryGA7kzcYGAhBstwLx
Host: localhost:5000
Referer: http://localhost:5000/
User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us)
AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1
upload=FieldStorage%28%27sysdump%27%2C+%27Case_45815_sysdump-Woking-
Bisley-20080702-163019.tgz%27%29&case_number=
2009-05-15 12:45:31 INFO request.POST= MultiDict([])
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---