quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gregory (Grisha) Trubetskoy" <gri...@apache.org>
Subject Re: Talking About PSP: Interface
Date Sat, 19 Apr 2003 02:43:47 GMT

On 18 Apr 2003, Mongryong wrote:

> > > response.write(string data):  Write data to the browser
> > > response.flush(void):  Flush the data buffer to the user
> >
> > mp request doesn't have a flush(), every write() is automatically flushed.
> > this is mainly for simplicity - if people want buffering, they can
> > use their own means, but most users don't care for it, so having to flush
> > is a nuisance
>
> Having the mp_request implement the entire stdio interface will make it
> useful for libraries that require a stdio object.  For example, many
> XML/XSL libraries take StringIO and file objects.
>
> ie. xsltProcessor.execute (outputStream=req);

Good point. Except I wouldn't have the request object do that, since the
request object is meant more as an interface to the Apache request.

A cleaner way to do it would be to have a separate object which takes
request as an argument to the constructor:

xsltProcessor.execute(outputStream = apache.HttpIO(req))

There is already something like that in apache.py - two classes called
CGIstdin and CGIstdout, used by cgihandler, both fully implement the io
interface.

Grisha


Mime
View raw message