[Twisted-Python] Re: [Twisted-commits] This forces a last modified header [...]

Kevin Turner kevin.m.turner at pobox.com
Thu Sep 26 19:02:03 EDT 2002


> +            # Set the last modified date to ask the browser to
> +            # not use a cached version.
> +            request.setLastModified(time.time())

Setting Last-Modified does not ask the browser not to use a cached
version.  Setting Last-Modified *allows* the browser to use a cached
version.  Setting it to now() is not the best way to say "don't use a
cache", particularly if it had no Last-Modified header on it before. 
Default behaviour is to always send the full page anyway, nothing will
ever change that to NOT_MODIFIED if you never do setLastModified.

If you don't want a page to be cached, you must set the conditions under
which a cache may be used for that page the *first time* you send it.

I'm not sure exactly what your situation is, so I won't try to go into
detail, but I suggest browsing over
http://www.mnot.net/cache_docs/#CONTROL

Cheers,

 - Kevin





More information about the Twisted-Python mailing list