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

Gregory (Grisha) Trubetskoy grisha at modpython.org
Fri Sep 26 10:53:56 EST 2003


Interesting...

If you could change filterobject.c, around line 223, where the code looks
like:

       if (! APR_STATUS_IS_SUCCESS(self->rc)) {
            PyErr_SetObject(PyExc_IOError,
                            PyString_FromString("Input filter read error"));
            return NULL;
To:

       if (! APR_STATUS_IS_SUCCESS(self->rc)) {
            PyErr_Format(PyExc_IOError, "Input filter read error: %d",
                         self->rc);
            return NULL;

This will log the actual return code that Apache is returning on this
error, it might give us more information on what is really going on there.

Thanks,

Grisha


On Fri, 26 Sep 2003, camge wrote:

> 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