controller:
def myimage():
    import cStringIO
    fig=Figure()
    canvas=FigureCanvas(fig)
    stream=cStringIO.StringIO()
    canvas.print_png(stream)    
    return stream.getvalue()

view:
{{extend 'layout.html'}}
<h1>This is the graph/myimage.html template</h1>
{{=IMG(_src=URL('myimage'))}}

resault (../graph/myimage):

�PNG

���
IHDR���������5 ...

it it the same if i remove the line
{{=IMG(_src=URL('myimage'))}}
from view

adding .png to the url or
response.headers['Content-Type']='image/png'
to the controller displays the image, but nothing else



Reply via email to