From: "Paul Winkler" <pw_lists@slinkp.com>
On Wed, Jun 02, 2004 at 04:22:04PM -0400, Small Business Services wrote:
After some investigation it turns out the server was closing the connection before all the data was written. The solution was:
RESPONSE.write(str(isrc))
Which created an http-friendly data stream (apparently something in the jpg data stream caused the problem).
or maybe RESPONSE.write(isrc) was implicitly doing repr(isrc) instead of str(isrc). not sure.
In any case, I'd again suggest calling isrc.index_html(request, RESPONSE). It scales much better to large images.
Your method will read the entire image data into memory as a string and not return anything to the client until it is done. Image.index_html() will stream the data in chunks as they are loaded from the ZODB. This uses less memory and is faster.
Thanks for the feedback Paul, I'd like to try your isrc.index_html() idea, what should index_html (script/method?) contain? (I assume its not the standard index_html dtml method that is the initial 'public' page for our web site - which has been modified extensively for our particular application). Jonathan