[Zope] Return image from Python Script

Jens Vagelpohl jens at dataflake.org
Tue Dec 14 10:55:16 EST 2004


> Thanks. For the record, my final code was:
>
> image_file = context.restrictedTraverse('/LDML/images/ldml.gif')
> context.REQUEST.RESPONSE.setHeader('content-type', 
> image_file.content_type)
> return image_file.data

That won't work if the file size is large and the data is stored in 
separate pData structures. You *must* do "return str(image_file.data)" 
to be on the safe side.

jens



More information about the Zope mailing list