Help! Disabling caching for external method
Hello, I've a fairly complicated business logic that I implemented in Python as an external method. Essentially, it takes in a list of tuples (generated by a ZSQL), current URL1 and returns a filtered list of tuples. It works very well on the command line. (ie ZOPE_HOME/bin/python myfile.py...) However, whenever I try to call it from a DTML method, the results I get back are (I think) cached ones, regardless of the URL1 I'm passing to it. Any help is greatly appreciated! I'm on Zope 2.1.6 on NT4 - upgradation to 2.4.3 is scheduled for next month. Many thanks in advance - vsb "Saying Windows XP is the most stable Windows is like saying asparagus is the most articulate vegetable" - Dave Barry
[Satheesh Babu]
I've a fairly complicated business logic that I implemented in Python as
an
external method. Essentially, it takes in a list of tuples (generated by a ZSQL), current URL1 and returns a filtered list of tuples. It works very well on the command line. (ie ZOPE_HOME/bin/python myfile.py...)
However, whenever I try to call it from a DTML method, the results I get back are (I think) cached ones, regardless of the URL1 I'm passing to it.
Any help is greatly appreciated!
I'm on Zope 2.1.6 on NT4 - upgradation to 2.4.3 is scheduled for next month.
Hmm, I use external methods all the time with Zope (various versions on Windows) and haven't seen that. It would be more a browser problem, and Netscape is notorious for caching when you don't want it to. It's possible to put instructions into the page not to cache - but I don't remember the details - isn't it a <meta> tag? Cheers, Tom P
On Wed, 16 Jan 2002, Thomas B. Passin wrote:
Hmm, I use external methods all the time with Zope (various versions on Windows) and haven't seen that. It would be more a browser problem, and Netscape is notorious for caching when you don't want it to.
It's possible to put instructions into the page not to cache - but I don't remember the details - isn't it a <meta> tag?
I have to disagree with this about netscape. I have tested it a lot and found that netscape reliably caches pages it is allowed to by spec. What you need to do is set the If-Modified-Since header in the RESPONSE to the date when the page changed and netscape will go ahead and fetch a new version of the page. My problems have been with IE which most of the time ignores that even when you click refresh. If you need other ways to tell the browser when to force the page to draw again please look at the http 1.0 and 1.1 specs. However it is worth it to note that IE has about the worst implementation of those specs I have ever seen in any browser in history. The bugs it has with content-type and content-disposition are staggering.
kosh@aesaeion.com wrote:
On Wed, 16 Jan 2002, Thomas B. Passin wrote:
Hmm, I use external methods all the time with Zope (various versions on Windows) and haven't seen that. It would be more a browser problem, and Netscape is notorious for caching when you don't want it to.
It's possible to put instructions into the page not to cache - but I don't remember the details - isn't it a <meta> tag?
I have to disagree with this about netscape. I have tested it a lot and found that netscape reliably caches pages it is allowed to by spec. What you need to do is set the If-Modified-Since header in the RESPONSE to the date when the page changed and netscape will go ahead and fetch a new version of the page.
One caveat though, which can bite one. If you use for instance <META HTTP-EQUIV=Expires CONTENT="-1d"> to make sure that the page is always fetched from the server, Netscape (4.x) won't let you print the document. It instead prints something like "This page has expired, please reload". This can be quite confusing for users.
My problems have been with IE which most of the time ignores that even when you click refresh. If you need other ways to tell the browser when to force the page to draw again please look at the http 1.0 and 1.1 specs. However it is worth it to note that IE has about the worst implementation of those specs I have ever seen in any browser in history. The bugs it has with content-type and content-disposition are staggering.
Content-disposition isn't part of the http-spec, and most of the other problems are (sadly!) by design. I once posted a url of a page at MS' knowledge base which describes the horror. cheers, oliver
Satheesh Babu writes:
.... However, whenever I try to call it from a DTML method, the results I get back are (I think) cached ones, regardless of the URL1 I'm passing to it. The results of External Methods are not cached (at least not by the External Method (or Zope)). You must have a different problem.
The problem may well be caching -- by the browser. You can usually detect this, when you call "reload" with the "Shift" key pressed. When this gives you the correct anwser, then the problem was caused by HTTP caching. There is a HowTo on Zope.org explaining how to control (HTTP) caching. Dieter
Hello guys, Solved it after tons of trial and error. I don't know if it is a bug in Python or in my code (this should be most likely!). I've attached my python script - you can run it from command line. Problem happens where I've marked "ALERT". It works now, but if you take out the default paramater there, it doesn't - it is as if older values left by previous function call is taken. -vsb "Saying Windows XP is the most stable Windows is like saying asparagus is the most articulate vegetable" - Dave Barry -----Original Message----- From: Dieter Maurer [mailto:dieter@handshake.de] Sent: Wednesday, January 16, 2002 2:44 PM To: sbabu@tnc.org Cc: zope@zope.org Subject: Re: [Zope] Help! Disabling caching for external method Satheesh Babu writes:
.... However, whenever I try to call it from a DTML method, the results I get back are (I think) cached ones, regardless of the URL1 I'm passing to it. The results of External Methods are not cached (at least not by the External Method (or Zope)). You must have a different problem.
The problem may well be caching -- by the browser. You can usually detect this, when you call "reload" with the "Shift" key pressed. When this gives you the correct anwser, then the problem was caused by HTTP caching. There is a HowTo on Zope.org explaining how to control (HTTP) caching. Dieter
participants (5)
-
Dieter Maurer -
kosh@aesaeion.com -
Oliver Bleutgen -
Satheesh Babu -
Thomas B. Passin