Returning an image and text from python script
I'd like to return from python script an image object to a dtml method which renders the image. If the state is edit - set by a cookie- the image should have a link for updating the image. I tried to add the text with the object which obviously failed. I also tried to return a string like "<dtml-var '_.getitem(' " + pictureName + " ,0'>" + linkText which only displays the string but didn't render the image. To return multiple values is not what I want because I want to have a simple funtion in the dtml-method like <dtml-var "getPicture('pic1')"> Thanks
Hello Sven, the rendering of a picture I solved in the following way: Python-Product: class ClassName(...): .... myPicture = None def changePicture(self, path): myPicture = ImageFile(path, globals()) .... dtml-code: <dtml-call expr="changePicture(path)"> <img src="myPicture"> Because of the dependencies of the two steps, It's not really good code, but the best I found for this problem until now. Ulla. Sven Hohage schrieb:
I'd like to return from python script an image object to a dtml method which renders the image. If the state is edit - set by a cookie- the image should have a link for updating the image. I tried to add the text with the object which obviously failed. I also tried to return a string like "<dtml-var '_.getitem(' " + pictureName + " ,0'>" + linkText which only displays the string but didn't render the image.
To return multiple values is not what I want because I want to have a simple funtion in the dtml-method like <dtml-var "getPicture('pic1')">
Thanks
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- Ulla Theiß eurodata GmbH & Co. KG Grossblittersdorfer Str. 257-259 66119 Saarbrücken Phone: +49 681 8808-773 Fax: +49 681 8808-800
Sven Hohage wrote at 2003-2-17 15:58 +0100:
I'd like to return from python script an image object to a dtml method which renders the image. If the state is edit - set by a cookie- the image should have a link for updating the image. I tried to add the text with the object which obviously failed. I also tried to return a string like "<dtml-var '_.getitem(' " + pictureName + " ,0'>" + linkText which only displays the string but didn't render the image.
To return multiple values is not what I want because I want to have a simple funtion in the dtml-method like <dtml-var "getPicture('pic1')">
Then you must learn how HTML displays images ;-) Look for the "img" tag. Generate one in your Python Script together with all necessary decoration. Dieter
participants (3)
-
Dieter Maurer -
Sven Hohage -
Ulla Theiss