This is a bit of a tricky question;
I'm working with mod_wsgi in python and want to make an output buffer that yields HTML on an ongoing basis (until the page is done loading).
Right now I have my script set up so that the Application() function creates a separate 'Page' thread for the page code, then immediately after, it runs a continuous loop for the Output Buffer using python's Queue lib.
Is there a better way to have this set up? I thought about making the Output Buffer be the thread (instead of Page), but the problem with that, is the Application() function is the only function that can be yielding the HTML to Apache, which (as far as I can tell, makes this idea impossible).
The downside I'm seeing with my current setup, is in the event of an error, I can't easily interrupt the buffer and exit without the Page thread continuing on for a bit.
(It kinda sucks that mod_wsgi doesn't have a build in output buffer to handle this, I hate loading the entire page then sending output just once, it results in a much slower page load).