[Zope] Random Images: How to defeat the cache
Small Business Services
toolkit at magma.ca
Wed Apr 28 14:22:44 EDT 2004
From: "Edward Pollard" <pollej at uleth.ca>
> I'm trying to make a quick and dirty random image product.
>
> It is a zClass based off of OFS::Folder.
>
> The index_html method is as follows:
> context.REQUEST.RESPONSE.setHeader( 'Cache-Control' ,'no-cache' )
> context.REQUEST.RESPONSE.setHeader( 'Pragma' ,'no-cache' )
>
> image_set = []
> images = context.objectValues('Image')
>
> for each in images:
> image_set.append(each)
>
> return_image = image_set[random.choice(range(0,len(image_set)))]
> return return_image.index_html(context.REQUEST,context.REQUEST.RESPONSE)
>
>
> This works fine as long as one shift-reloads the image. Otherwise it
> does not change the image. Obviously my attempts to defeat the browser
> cache are not succeeding.
Try adding setting the expiry time:
<meta http-equiv="expires" content="Sat, 01 Jan 2001 00:00:00 GMT">
HTH
Jonathan
More information about the Zope
mailing list