Graham Dumpleton
graham.dumpleton at gmail.com
Sat May 19 21:39:13 EDT 2007
On 20/05/07, Martin _ <gzlist at googlemail.com> wrote: > def handler(req): > buf = [] > for i in xrange(1000): > buf.append("Yeah\n") > req.write("".join(buf), 0) > return apache.OK Or to avoid buffering in Python code and letting Apache buffering do its thing instead use: def handler(req): for i in xrange(1000): req.write('Yeah\n, 0) return apache.OK By default req.write() flushes data on each call, which using 'print' with it would result in happening. Thus call req.write() directly and supply second argument of 0 to avoid flushing. Graham
|