[zopeorg-checkins] CVS: Products/ZopeOrg-NV - __init__.py:1.33

Brian Lloyd brian at zope.com
Mon Aug 11 13:21:39 EDT 2003


Update of /cvs-zopeorg/Products/ZopeOrg-NV
In directory cvs.zope.org:/tmp/cvs-serv20145

Modified Files:
	__init__.py 
Log Message:
add vary hack

=== Products/ZopeOrg-NV/__init__.py 1.32 => 1.33 ===
 CatalogTool.__call__ = searchResults
 
 
+# Monkey-patch to ensure that (a) a Vary tag is put in the response
+# headers of all requests and (b) that the CMF cache policy tool is
+# called on all requests.
+
+from ZServer.HTTPResponse import ZServerHTTPResponse
+
+real__str__ = ZServerHTTPResponse.__str__
+
+def resp__str__(self, func=real__str__):
+    headers = self.headers
+    if not (headers.has_key('vary') or headers.has_key('Vary')):
+        self.setHeader('Vary', 'Cookie')
+
+    return func(self)
+
+ZServerHTTPResponse.__str__ = resp__str__
+
+
+
+
+
 from Products.CMFDefault.DublinCore import DefaultDublinCoreImpl
 DefaultDublinCoreImpl._DefaultDublinCoreImpl__FLOOR_DATE   = DateTime(1979, 0)
 DefaultDublinCoreImpl._DefaultDublinCoreImpl__CEILING_DATE = DateTime(2979, 0)





More information about the zopeorg-checkins mailing list