[Zope] Random Images: How to defeat the cache

Edward Pollard pollej at uleth.ca
Wed Apr 28 13:54:15 EDT 2004


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.

Can anyone tell me why?




More information about the Zope mailing list