Oleg Broytmann wrote: > Hello. > > QuixoteHandler (server/http_medusa.py) force any output to be a string > (qreq.response.set_body(str(output))). This means that a published object > cannot return a producer. > > Why? Producers are very useful for returning huge objects, or objects > that are slowly calculated on the fly. > > Though I have not tried it yet, I think it woyld be relatively easy to > modify server/http_medusa.py to allow output to be a producer (an object > with .more() method). I am going to try it. Will anyone be interested in my > patches? > > Oleg. Agreed -- it could be very helpful for Medusa-hosted apps, esp. when returning large objects. I use a file_producer in my medusa_http script. (I recall submitting this as a patch, but not whether it was accepted.) This resulted in an enormous performance increase for large files. Are you suggesting, however, that your *application* should be able to return a producer? Or something else with an generator-like interface? Personally I like the idea, but would want to make sure that it could work correctly with all front ends, so I would vote either for using a (not-yet-written) quixote.http_response.DeferedResponse, or just a response object that has a Python iterator interface. It seems to me that this approach would require Chunked encoding in order to work properly on pipelined connections (you can't guarantee the content length in advance). We discussed this a bit on the list a few months ago, but I can't look up a reference right now. -- Graham