Hi All,

I'm in the process of writing a python script that goes through a long list in batches and outputs its progress to HTML. (Zope 2.7.5 behind Apache)

The result is not what I expected: instead of returning the results in small chunks, Zope (Apache, gremlins?) rewrites the output and returns much larger sections of data.

If I remove the Transfer-Encoding header and replace it with a fixed Content-Length, I can see that my script outputs its chunks as intended...

Can anyone offer suggestions?


[Code below:]

RESPONSE.setHeader('Content-Type', 'text/html')
RESPONSE.setHeader('Transfer-Encoding', 'chunked')
RESPONSE.write( str(hex(len(htmlHeader)))[2:]+'\n'+htmlHeader+'\n' )

def doBatch(start, end):
  -- run through list and output --

while myBatch <= numBatches and start <> -1:
  start = doBatch(start,end)
  end = start + batchSize
  myBatch +=1


[incorrect HTML output snippet:]

HTTP/1.1 200 OK
Date: Fri, 15 Sep 2006 22:37:22 GMT
Server: Zope/(Zope 2.7.5-final, python 2.3.5, freebsd4) ZServer/1.1
Content-Type: text/html
X-Cache: MISS from xxx.xxx.xxx
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked

    <title>Progress Report...</title>
    <h2>Batch 0: 0 - 25</h2>     <-- expected new chunk
    <h2>Batch 1: 26 - 51</h2>    <-- expected new chunk
    <h2>Batch 2: 51 - 76</h2>    <-- expected new chunk
    <h2>Batch 3: 76 - 101</h2>   <-- why does chunk start here?
    <hr>                         <-- expected new chunk

Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to