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. -- Robin Becker
In article <dBxWjBAissu3EwWl@jessikat.demon.co.uk>, Robin Becker <robin@jessikat.demon.co.uk> writes
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. I found that ChartClock should be defined as def ChartClock(self): return self['REQUEST'].ChartClock
unfortunately this just raises the question as to why I didn't get an error message with the former. I still don't see the second image. -- Robin Becker
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 ------------------------------------------
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
participants (2)
-
Martijn Pieters -
Robin Becker