Nick
nick at dd.revealed.net
Tue Aug 17 10:08:49 EDT 2004
It is simple enough to do your own buffering with a CStringIO, which is relatively fast and file-like, and then sending the resulting buffer at the end of your handler to req.write. Nick Gregory (Grisha) Trubetskoy wrote: > > By "getting back" I meant having any access to it. Once it's written > out, the data becomes owned by the next module/filter in the filter > chain. The only way to do this would be for mod_python to do its own > buffering, which it does not. > > Grisha > > On Mon, 16 Aug 2004, Iker Arizmendi wrote: > >> I don't need to get it back, I just need to clear it so >> I can send just the error page without any dangling output >> from the faulty page. I guess one solution is to write the >> output to a buffer in Python code and only call req.write >> once all processing is complete. But this would eliminate >> the need for PSP (unless PSP offers a way to direct it's >> output to my own buffer). >> >> Iker >> >> >> Gregory (Grisha) Trubetskoy wrote: >> >>> >>> Hmm... The buffer that buffers output is controlled by Apache, and >>> AFAIK once something's been written to it, you cannot get it back. >>> >>> Grisha >>> >>> On Mon, 16 Aug 2004, Iker Arizmendi wrote: >>> >>>> One problem I've encountered with using set_error_page() >>>> for error handling is that often the faulty page has already >>>> generated some output when the error is encountered. This >>>> results in garbled pages with bits from both the error-raising >>>> page and the error-catching page. >>>> >>>> Is there some way to get around this? >>>> >>>> Regards, >>>> Iker >>>> >>>> >>>> Iker Arizmendi wrote: >>>> >>>>> Thanks Greg. Is there a method that clears the >>>>> current output buffer as well? >>>>> >>>>> Gregory (Grisha) Trubetskoy wrote: >>>>> >>>>>> >>>>>> Yes, by default PSP does not flush the output buffer until the >>>>>> very end which looks like what PHP ob_start func enables. If you >>>>>> want to force a flush from within PSP, you can always call >>>>>> req.flush(). >>>>>> >>>>>> Grisha >>>>>> >>>>>> On Fri, 13 Aug 2004, Iker Arizmendi wrote: >>>>>> >>>>>>> Does the PSP handler support output buffering? >>>>>>> Something along the lines of ob_start under PHP? If >>>>>>> explicit support is not there, is there some other >>>>>>> way to accomplish the same thing? >>>>>>> >>>>>>> Thanks, >>>>>>> Iker >>>>>>> >>>>> >>>> >> >> -- >> Iker Arizmendi >> AT&T Labs - Research >> Speech and Image Processing Lab >> e: iker at research.att.com >> w: http://research.att.com >> >> >> _______________________________________________ >> Mod_python mailing list >> Mod_python at modpython.org >> http://mailman.modpython.org/mailman/listinfo/mod_python >> > _______________________________________________ > Mod_python mailing list > Mod_python at modpython.org > http://mailman.modpython.org/mailman/listinfo/mod_python
|