[mod_python] [help]please give an input filter example ?

camge is83070 at cis.nctu.edu.tw
Fri Sep 26 15:55:26 EST 2003


regardless of Content-Length problem,
I found my apache's error log has these error message when I post data to
cgi.
------------------------------------------------
...
[Fri Sep 26 15:51:31 2003] [error] [client 192.168.100.219] inputfilter
cameoInputFilter: Traceback (most recent call last):, referer:
http://192.168.100.161/test/index.htm
[Fri Sep 26 15:51:31 2003] [error] [client 192.168.100.219] inputfilter
cameoInputFilter:   File "C:\Program
Files\WebSite\lib\python22\lib\site-packages\mod_python\apache.py", line
222, in FilterDispatch
    object(filter), referer: http://192.168.100.161/test/index.htm
[Fri Sep 26 15:51:31 2003] [error] [client 192.168.100.219] inputfilter
cameoInputFilter:   File "C:/Program
Files/WebSite/httpd/CameoMobileSpace\cameoInputFilter.py", line 9, in
inputfilter
    strBody = filter.read(), referer: http://192.168.100.161/test/index.htm
[Fri Sep 26 15:51:31 2003] [error] [client 192.168.100.219] inputfilter
cameoInputFilter: IOError: Input filter read error, referer:
http://192.168.100.161/test/index.htm
...
-------------------------------------------------
although having error log, input filter still works.
Should I catch this exception? and how to handle it, close filter or just
return?
Below is my simple inputfilter:

def inputfilter(filter):
    strBody = filter.read()
    if strBody:
        filter.write(strBody)
    else:
        filter.close()
    return apache.OK



More information about the Mod_python mailing list