[Zope] Return image from Python Script

Simon Forster simon-lists at ldml.com
Tue Dec 14 09:38:45 EST 2004


On 14 Dec 2004, at 14:03, Tino Wildenhain wrote:

> Hi,
>
> On Tue, 2004-12-14 at 13:28 +0000, Simon Forster wrote:
>> How do I return an actual image file from within a Python Script?
>>
>> return context.restrictedTraverse('/LDML/images/ldml.gif')
>>
>> Gives me:
>>
>> <img src="http://127.0.0.1:8080/LDML/images/ldml.gif" alt="" title=""
>> height="120" width="120" border="0" />
>>
>> But what I actually want to do is return the file itself. Think Python
>> Script as symbolic link.
>>
>> Sorry, must be v. easy but I've been thrashing around on various sites
>> for about an hour now and I'm getting no closer.
>
> return str(context.restrictedTraverse('/LDML/images/ldml.gif'))
>
> btw. you dont need to give suffixes to images in Zope :-)
>
> Regards
> Tino

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?

Thanks

Simon Forster
_____________________________________________________
  LDML Ltd, 62 Pall Mall, London, SW1Y 5HZ, UK
  Tel: +44 (0)870 1999 780   Fax: +44 (0)70 9230 5247
_____________________________________________________



More information about the Zope mailing list