[Zope] Return image from Python Script

Tino Wildenhain tino at wildenhain.de
Tue Dec 14 10:29:40 EST 2004


On Tue, 2004-12-14 at 14:38 +0000, Simon Forster wrote:
> On 14 Dec 2004, at 14:03, Tino Wildenhain wrote:
> 

> Sorry. Obviously didn't make myself clear.
> 
> return context.restrictedTraverse('/LDML/images/ldml.gif')
> 
> gives me the string
> 
> <img src="http://127.0.0.1:8080/LDML/images/ldml.gif" alt="" title="" 
> height="120" width="120" border="0" />
> 
> But what I'm after is the actual binary image file. How do I get this?

Sorry, I was with File, since str(zopefileobject) gives you its data.
Image is a bit different and renders just the tag on __str__.

Image.data then (like in the other posts) but this might 
be not the most performant way to do it with respect to later
versions of zope. But currently, it is.

Regards
Tino



More information about the Zope mailing list