[Zope] Random Images: How to defeat the cache

Mark Gibson mark at kaivo.com
Wed Apr 28 19:51:10 EDT 2004


Edward Pollard wrote:
> 
> On Apr 28, 2004, at 2:53 PM, Mark Gibson wrote:
> 
>> Edward Pollard wrote:
>>
>>> On Apr 28, 2004, at 12:22 PM, Small Business Services wrote:
>>>
>>>>
>>>> Try adding setting the expiry time:
>>>>
>>>> <meta http-equiv="expires" content="Sat, 01 Jan 2001 00:00:00 GMT">
>>>>
>>> Of course, I'm dealing with images, not HTML content, so META tags 
>>> are right out.
>>> But I added this as a header (using the same mechanism as the 
>>> previous example) with no luck.
>>
>>
>> I've had some luck with this combination:
>>
>>     RESPONSE.setHeader('Expires', 'Fri, 05 Jul 2002, 05:00:00 GMT' );
>>     RESPONSE.setHeader('Cache-Control', 'no-store');
>>     RESPONSE.setHeader('Pragma', 'no-cache');
>>
> 
> No improvement.
> 

Hmm. You said this was the index_html in a Zclass.  Can you have it 
return an <img> tag instead of the image itself?  Then you could do 
something like this:

imageid=randomImage() #returns id of some random image

return '<img src="%s/%s" />'%(context.absolute_url(),imageid)

No more caching issues.

Mark



More information about the Zope mailing list