[Zope] Probable Bug in "OFS.Image.index_html"

Dieter Maurer dieter@handshake.de
Fri, 18 Aug 2000 20:21:36 +0200 (CEST)


Today, I met again a strange problem:

  I wanted to implement an image relay for an international project:
  something like: if an image in the target language is available,
  take it, otherwise, the english image.

  My DTML looked like:

	<dtml-let src="have_image(name,language) and _.getitem(language) or EN"
	          image="_.getattr(src,name)"
	><dtml-var "image.index_html(REQUEST,RESPONSE)">

  The result was very strange:

    When I forced Netscape to reload the image (SHIFT + reload),
    everything worked fine. 
    However, when I did a simple reload, it sometimes worked
    and sometimes did not (showed a broken image).

    When I loaded the image with Pythons httplib, everything
    worked fine.

  I tracked this down to line 219 of "OFS/Image.py":
    Zope arrives their, when it receives an
    "IF-MODIFIED-SINCE" header and determines that
    the browser has an up to date image in its cache.
    Zope correctly set status 304 and then
    returns "RESPONSE".

    It seems that this is not a problem, when "index_html"
    is directly called from ZPublisher.
    However, in the context of the above "dtml-var",
    it confused Netscape completely (I can understand that!).

  I changed the "return RESPONSE" into "return ''"
  and everything works fine again.


I will put this into the collector.


Dieter