[Zope] image objects into table via python script

John Schinnerer johnschinnerer at yahoo.com
Wed Nov 17 16:14:15 EST 2004


Hello,

I am using a python script to generate an HTML table structure.
The script is called from a page template, like this:
<span tal:replace="structure
python:container.renderTable('CatalogQueryParameter')" />

The script (renderTable) iterates over items returned from a catalog
query which is passed one parameter.
To put for example a date or string property in the table is easy, like
this:

...
for item in resultItems:
	print("<td>")
	print(item.creation_date.strftime('%B %Y'))
	print("</td>")
        ...
return printed

What I really need to put in the table, though, are Image objects that
are part of the objects returned.

How can I put the Image object into the table structure returned by the
script, so that the Image object will render itself as usual?  That is,
as it would in for example:

<span tal:replace="structure here/art_image" />

The below of course does not work (art_image is an Image object in the
item object) - it gives a TALES attribute error on art_image:

...
for item in BGitems:
	print("<td>")
	print(item.art_image)
	print("</td>")
        ...
return printed

...and I am stuck on how to get the art_image Image object into the
table returned by the script.


thanks,
John S.


		
__________________________________ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 



More information about the Zope mailing list