[Zope] Zope-2.6 acquisition problem

Oliver Bleutgen myzope@gmx.net
Fri, 29 Nov 2002 11:20:11 +0100


Thierry Florac wrote:
>   Hi,
> 
> 
> On Thu, 2002-11-28 at 17:18, Oliver Bleutgen wrote:
> 
>>>I created several new "folder like" products with new properties and
>>>methods, which hinerit from SimpleItem, PropertyManager and
>>>ObjectManager.
>>>My problem is simple :
>>> 1. I put an image in a folder, with name "logo" => OK
>>> 2. I put a different image in a subfolder, with name "toto" => OK
>>> 3. I rename the second image to "logo" => ERROR: when downloading the
>>>image, I get the image from the parent folder !!!
>>> 4. I rename the second image to "toto" => OK, I retrieve the original
>>>image...
>>>
>>>I think that this is in complete contradiction with Zope acquisition
>>>principles, so I suppose that I missed something...
>>
>>How do you "show" the image when this happens, directly via it's url, an 
>>image-tag, or <dtml-var logo>?
> 
> 
> At first, just in the ZMI !!
> In fact, I think I solved the problem, but I'm not sure of any good
> explanation :
>  - first, I added 'Acquisition.Implicit' as the first inherited class of
> my custom object manager (but I think it's already done throught
> ObjectManager inheritance),
>  - second, I removed my first image from an HTTP cache manager with
> which it was associated.
> 
> After this, I packed the database, restarted Zope, and now everything
> seems right, but several questions remain: how does HTTP cache managers
> handle acquition ? In fact, I just use <img src="logo"> in my HTML
> pages; if only the first image is associated with the cache manager, why
> is the first image retrieved when it's the second one (not associated
> with the cache) which is first in the acquisition path ??
> 
> If this behaviour is "normal", I don't understand when and how cache
> managers should be used...

This is surely not a problem of the http-cache manager, because all it 
does is putting appropriate headers for caching in the RESPONSE, and the 
client (i.e. browser/proxy) decides what to make of it.
In your case I assume that in step 3, the image wasn't really loaded 
from zope, but taken from the browser/proxy cache instead. I have made 
the experience that browsers are more lax when it comes to images.
The client caches identify which objects they assume to be the same by 
looking at the URI, in your case "someserver/folder/subfolder/logo", 
which is the same for the two different cases in 1 and 3.
To find out and understand what really is going on you can use shanes 
tcpwatch.py, or maybe just take a sharp look at the properties of the 
image in the browser.
There whole concept is somewhat more complex, but I think the above 
explains what has happened in your case.


cheers,
oliver