[Zope-Checkins] CVS: Zope/lib/python/webdav - Resource.py:1.54 EtagSupport.py:1.9

Casey Duncan casey@zope.com
Thu, 19 Sep 2002 11:30:19 -0400


Update of /cvs-repository/Zope/lib/python/webdav
In directory cvs.zope.org:/tmp/cvs-serv831/lib/python/webdav

Modified Files:
	Resource.py EtagSupport.py 
Log Message:
Collector #574: Fixed write on HEAD requests caused by overzealous ETag support.


=== Zope/lib/python/webdav/Resource.py 1.53 => 1.54 ===
--- Zope/lib/python/webdav/Resource.py:1.53	Thu Aug 29 10:33:29 2002
+++ Zope/lib/python/webdav/Resource.py	Thu Sep 19 11:30:19 2002
@@ -167,7 +167,9 @@
             mtime=rfc1123_date(self._p_mtime)
             RESPONSE.setHeader('Last-Modified', mtime)
         if hasattr(aq_base(self), 'http__etag'):
-            RESPONSE.setHeader('Etag', self.aq_base.http__etag())
+            etag = self.http__etag(readonly=1)
+            if etag:
+                RESPONSE.setHeader('Etag', etag)
         RESPONSE.setStatus(200)
         return RESPONSE
 


=== Zope/lib/python/webdav/EtagSupport.py 1.8 => 1.9 ===
--- Zope/lib/python/webdav/EtagSupport.py:1.8	Wed Aug 14 18:11:40 2002
+++ Zope/lib/python/webdav/EtagSupport.py	Thu Sep 19 11:30:19 2002
@@ -66,9 +66,11 @@
     """
     __implements__ = (EtagBaseInterface,)
 
-    def http__etag(self):
+    def http__etag(self, readonly=0):
         try: etag = self.__etag
         except AttributeError:
+            if readonly: # Don't refresh the etag on reads
+                return
             self.http__refreshEtag()
             etag = self.__etag
         return etag