[mod_python] set_error_page and output buffering

Iker Arizmendi iker at research.att.com
Mon Aug 16 18:23:50 EDT 2004


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




More information about the Mod_python mailing list