[mod_python] OutputFilter example

Gregory (Grisha) Trubetskoy grisha at modpython.org
Mon Jan 5 21:58:24 EST 2004

I think this is the way it's supposed to work.

On Mon, 5 Jan 2004, Dan W. wrote:

> In the example of the output filter in the 3.1.2b documentation the last
> lines seem to indicate that filter.close() should only be called if
> filter.read() returns None.  I paired up an output filter this evening with
> the mod_python.psp handler and I was getting an empty string on the last
> filter.read() for every request.  The example code only calls
> filter.close() if the last read result is None.  Not calling filter.close()
> on the first call caused the output filter handler to be called a second
> time.  The second time around, it tried to read from filter.read() and got
> None, therefore calling filter.close() and ending the cycle.  Should this
> be normal behavior or should I be calling filter.close() when filter.read()
> returns empty string as well?
> My server config:
>      AddHandler mod_python .psp
>      PythonHandler mod_python.psp | .psp
>      PythonOutputFilter mypackage.mymodule TESTFILTER
>      AddOutputFilter TESTFILTER .psp
> -Dan
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python

More information about the Mod_python mailing list