[mod_python] OutputFilter example

Dan W. dwmp at opti.cgi.net
Mon Jan 5 01:41:02 EST 2004


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



More information about the Mod_python mailing list