[Zope-dev] Problem with reading zope objects from external method.

Heiko Stoermer Heiko Stoermer <heiko.stoermer@innominate.de>
Fri, 28 Apr 2000 09:48:44 +0200


Anders Lide'n wrote:
> 
> I want to draw a circle on a picture that I have stored inside zope. Since
> the image manipulation module (PIL) is a module not usable from inside
> zope I have to use an external method.
> 
> The external method now needs to read in the file (the picture) and this
> file is located inside zope as a zope object (image file). Hence : I need
> to get the external method to read a zope object. But I continually fail
> to read the zope object, how do I do?
> 
>         Anders Lidén                    NetGuide / TerraTel AB
>         al@netg.se                      Tankegĺngen 4
>         Url:http://www.netg.se/         417 56  GÖTEBORG
>         Mobile : 0736 - 73 55 32        +46 - (0)31 - 50 79 69
> 


in python, if obj is you image object, do:

	data = str(obj.data)

you will then have the complete image in the variable "data".

if you cannot "find" the object from within python, pass it to the
external method as a parameter. make sure the external method is called
in a place where it can see the object. often something like this helps

<dtml-with "PARENTS[0]">
	<dtml-call "YourExtMeth(obj=YourImage)">
</dtml-with>

hope this helps,
Heiko



-- 
heiko.stoermer@innominate.de
                                                        innominate AG
                                                     networkingpeople
fon: +49.30.308806-0 fax: -77               web: http://innominate.de