[Zope] How to return two images by one procedure

J Cameron Cooper jccooper@jcameroncooper.com
Wed, 02 Jul 2003 15:01:44 -0500


>
>
>>I worte an external procedure which returns an image.  Now I want
>>to add an additional image showing a legend to exactly this
>>dynamically created image.  Unfortunately I have no idea how
>>I can make sure that this legend is connected to the image created
>>in the external procedure.
>>
>>Any idea how to solve this?
>>    
>>
>
>Return a tuple:
>
>IN EXTERNAL METHOD:
>def image_processing_function():
>      return image1, image2
>
>IN DTML TEMPLATE:
><dtml-let images="image_processing_function()">
>     <dtml-var expr="images[0]">
>     <dtml-var expr="images[1]">
></dtml-let>
>  
>
That'll try to inline the images, which won't work. If you want to 
create them at the same time, you'll probably have to create a folder 
with two images in it, and store it somehow. Your external method would 
want to return the name of the created container.

The better answer is to make two methods (one for image, one for key) 
and give both methods the same parameters so they can create images on 
the same information. That won't work if you have non-parameterized 
controls (random or external), in which case you'll have to figure out 
some sort of index/snapshot scheme.

          --jcc