[Zope-dev] ZopeBug: No Last-Modified for misc_/.../*.gif objects!!!!

Dieter Maurer dieter@handshake.de
Sat, 18 Nov 2000 13:57:49 +0100 (CET)


The Doctor What writes:
 > .... missing "Last-Modified" header for "App.ImageFile" objects
 > prevents caching ....

Appended is a partial patch.

  It adds the "Last-Modified" header but does not handle
  "If-Modified-Since" headers in requests.

I have put the patch into the locator.


Dieter

-----------------------------------------------------------------------
--- lib/python/App/ImageFile.py~	Fri May 28 17:49:25 1999
+++ lib/python/App/ImageFile.py	Sat Nov 18 12:21:44 2000
@@ -123,6 +123,7 @@
     def index_html(self, REQUEST, RESPONSE):
         """Default document"""
         RESPONSE.setHeader('Content-Type', self.content_type)
+        RESPONSE.setHeader('Last-Modified', self.lmh)
         f=open(self.path,'rb')
         data=f.read()
         f.close()
--- lib/python/App/Common.py~	Fri Nov 17 23:36:49 2000
+++ lib/python/App/Common.py	Sat Nov 18 12:31:18 2000
@@ -126,7 +126,7 @@
     #     useless.  klm 11/13/2000.
     if ts is None: ts=time.time()
     year, month, day, hh, mm, ss, wd, y, z = time.gmtime(ts)
-    return "%s, %02d-%3s-%4d %02d:%02d:%02d GMT" % (weekday_abbr[wd],
+    return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % (weekday_abbr[wd],
                                                     day, monthname[month],
                                                     year,
                                                     hh, mm, ss)