[Zope-dev] Writing results directly back to browser

David S. Harrison dsh@magma-da.com
Thu, 11 Nov 1999 10:32:01 -0800


Maybe I am not understanding your point.  What is the type of 'imag'
in your example?  Is it a string?  If so, that means that the external
image must write the image to disk and that location must be visible
to the ZServer.  I would like to avoid it if possible.  If 'imag'
is some other type, how does ZServer know what to do with it?

Pavlos Christoforou wrote:
> 
> On Thu, 11 Nov 1999, David S. Harrison wrote:
> 
> >
> > Maybe I am not being clear.  There is no image file.  It will be generated
> 
> No you were clear ...
> 
> > completely from within the external method.  I would like the external
> > method to write to some sort of sink that will deliver the bits
> > directly to the browser.  If I can help it, I don't want the image
> > to be written to disk at all.
> 
> Still I will repeat the original recipe ;-)
> 
> > >
> > > def gen_im(self):
> > >         imag=<code to generate image on the fly>
> > >         return imag
> > >
> 
> access it like:
> 
> http://Zobjects.in.the.mirror.appear.harder/myfolder/gen_im
> 
> ok maybe you need to set:
> RESPONSE.setHeader('content-type','<your image type'>) before you return
> the object
> 
> Pavlos