[mod_python] Output from C functions

Gregory Trubetskoy grisha at modpython.org
Mon Oct 30 09:56:54 EST 2000


On Mon, 30 Oct 2000, Alexis Iglauer wrote:

> > I think your problem is thinking in terms of CGI. If
> > you are after speed,
> > then CGI is hardly the answer anyway. If I were you,
> > I would start getting
> > confortable with the idea of abandoning the cute CGI
> > printf way of
> > outputting things. ;-)
> 
> I know, I know - and I am busy writing another app by
> implementing my own handler, but after reading the
> above sentence I am now no longer sure that I am doing
> the right thing there.  I am essentially creating my
> webpage dynamically by doing a whole bunch of
> req.write('<Stick HTML in here>') calls.  Is this
> efficient, and if not, what is?

Yes, very efficient.

> My calculation app will be rewritten as a handler
> sometime soon, but I think I will still have the same
> problem - how do I output to the web client (or find
> another way to keep the web client's attention) from
> inside my speed-optimised C loop?

You use the same req.write function except you call it from C (see the
code I sent in previous e-mail), or you can study the req.write() code and
use the Apache calls directly.

Grisha




More information about the Mod_python mailing list