Receiving large files with @tornado.web.stream_request_body
Nagy László Zsolt
gandalf at shopzeus.com
Wed Sep 24 10:31:28 EDT 2014
@tornado.web.stream_request_body
> class PostFilesHandler(tornado.web.RequestHandler):
> def post(self):
> for postfile in self.request.files:
> print("File info:",postfile) # There is no
> postfile["body"] here!!!
>
> def prepare(self):
> self.temp_file = tempfile.NamedTemporaryFile(delete=False)
>
> def data_received(self, chunk):
> self.temp_file.write(chunk) # This is great but which file is
> this???
>
>
I have found out that the raw post data is stored there. Extracting file
contents from that raw file is possible. However, the provisional
email.contentmanager class does not provide methods for extracting
streams from a mime message. Which is bad, because nobody wants to load
a huge mime message into memory (for example, a DVD iso file...)
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the Python-list
mailing list