[Zope] temporary images

Robin Becker robin@jessikat.demon.co.uk
Thu, 19 Aug 1999 16:56:17 +0100


In article <4.2.0.58.19990819094906.03efa310@lisp.atmm.nl>, Martijn
Pieters <mj@antraciet.nl> writes
>At 17:02 18/08/99 , Robin Becker wrote:
>>My Zen has vanished. I want to calculate some images and have them
>>displayed. I tried some simple experiments with external methods.
>>
>>ImageClock(self) computes the bytes for a Gif image of the current time.
>>UniqueId(self) returns a unique identifier. ChartClock is defined thusly
>>def ChartClock(self):
>>     return self.REQUEST['ChartClock']
>>
>>when this is displayed I see the first image, but not the second.
>>
>><dtml-var standard_html_header>
>><p>This works <img src=ImageClock?_,<dtml-var UniqueId> ></p>
>><dtml-call "REQUEST.set('ChartClock',ImageClock(_))">
>><p>This doesn't <img src=ChartClock?_,<dtml-var UniqueId> ></p>
>><dtml-var standard_html_footer>
>>
...
Yes I eventually grok this. The conceptual errors are that the External
functions are actually called after DTML expansion is completed and are
carried out on the client browser referring back the server. Clearly by
that time the REQUEST variable in my DTML document is long vanished.

So what I need are semi-persistent things. I either have to provide a
mechanism of my own to connect the calculation to the images which say
figures out when all the images have been calculated and used by the
client or provide a temporary directory. In either case I need some
simple rule to throw the stuff away when it's no longer needed. A
timeout is probably suitable.
-- 
Robin Becker