[Zope] temporary images
Martijn Pieters
mj@antraciet.nl
Thu, 19 Aug 1999 09:58:30 +0200
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>
>
>Firstly why don't I get an error with too many arguments.
>Secondly why/how do these two processes differ.
>
>The reason for the <dtml-var UniqueId> is to make each view of the clock
>different.
>--
Hmm.... <img src=IMageClock?_,<dtml-var UniqueID> > means that the browser
will call the object ImageClock with '?_,[anUniqueID]', which, to my mind,
will not do what you think it'll do. You don't need to pass in the _
namespace anyway, and your code certainly doesn't accomplish that. Zope
will not be able to parse the query string, and won't do anything with it.
It will however fool the browser in thinking it is a unique URL and will
not serve up a cached image.
Next, you have the browser calling the URL
'ChartClock?_,[anOtherUniqueID]', which is a separate request to the Zope
server, so any changes made in the REQUEST object in your DTML document are
no longer visible. In this separate request, no value exists for
'ChartClock'. Returning self.REQUEST['ChartClock'] will result in an error.
--
Martijn Pieters, Web Developer
| Antraciet http://www.antraciet.nl
| Tel: +31-35-7502100 Fax: +31-35-7502111
| mailto:mj@antraciet.nl http://www.antraciet.nl/~mj
| PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149
------------------------------------------