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

camge is83070 at cis.nctu.edu.tw
Wed Sep 24 09:25:36 EST 2003


Dear Grisha,

    Many Thanks for your help!
But I dont have compile environment.
What packages must install if My dev platform is windows and
runtime environment is Apache/2.0.44 (Win32) + Python/2.2.2  ?
I am a newbie on apache.

Best regards,
camge

----- Original Message ----- 
From: "Gregory (Grisha) Trubetskoy" <grisha at modpython.org>
To: "camge" <is83070 at cis.nctu.edu.tw>
Cc: "David Fraser" <davidf at sjsoft.com>; <mod_python at modpython.org>
Sent: Tuesday, September 23, 2003 10:35 PM
Subject: Re: [mod_python] [help]please give an input filter example ?


>
> I've looked at the input filter code, and I think that what's in 3.0.3 is
> broken. If you get the latest CVS version, your input filter code would
> look somethng like:
>
> def inputfilter(filter):
>
> s = filter.read()
>
> if s:
> ## do something with s here
>
> filter.write(s)
> else:
> filter.close()
>
> return apache.OK
>
> Note that the filter will only see the body of the POST request, it will
> not see the headers, in fact it won't even be called for GET requests.
>
> Grisha
>
> On Fri, 19 Sep 2003, camge wrote:
>
> > > >I need input filter to convert character set of form data submitted
by
> > cell
> > > >phone browser.
> > > >For example, convert utf-8 to big5 or gb.
> > > >If I can do it in input filter, then I dont need to modify all of my
> > pages.
> > > >
> > > >
> > > Aha. What I would do is just put a function in a module that changes
the
> > > encoding.
> > > Get the arguments like you normally would, then just do a
decode/encode.
> > > Since that module can be accessed from anywhere, it will work just as
> > well.
> > > Also, it's less likely to cause bugs, and will probably be faster
> > > (you'll only making one jump into the Python interpreter and back)
> > >
> > > Cheers
> > > David
> > >
> > Thanks for your suggestion!
> > But my web server serve not only wap browser but also Pocket IE and IE,
> > and they all use same module(for easy maintenance).
> > Adding this function in these modules will be a terrible thing,
> > because I dont need to convert character encoding for Pocket IE and IE.
> >
> > If I can do it in input filter, I don't need to modify any things in
> > original module.
> >
> > regards,
> > camge
> >
> >
> > _______________________________________________
> > 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