Changeset 1208
- Timestamp:
- 08/02/06 23:38:53
- Files:
-
- trunk/cherrypy/lib/caching.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/lib/caching.py
r1207 r1208 180 180 If 'force' is False (the default), the following headers are checked: 181 181 'Etag', 'Last-Modified', 'Age', 'Expires'. If any are already present, 182 none of the "cache prevention"headers are set.182 none of the above response headers are set. 183 183 """ 184 184 185 if isinstance(secs, datetime.timedelta):186 secs = (86400 * secs.days) + secs.seconds187 expiry = http.HTTPDate(cherrypy.response.time + secs)188 189 if secs == 0:190 cacheable = False191 if not force:192 # some header names that indicate that the response can be cached193 for indicator in ('Etag', 'Last-Modified', 'Age', 'Expires'):194 if indicator in cherrypy.response.headers:195 cacheable = True196 break197 if not cacheable:185 cacheable = False 186 if not force: 187 # some header names that indicate that the response can be cached 188 for indicator in ('Etag', 'Last-Modified', 'Age', 'Expires'): 189 if indicator in cherrypy.response.headers: 190 cacheable = True 191 break 192 193 if not cacheable: 194 if isinstance(secs, datetime.timedelta): 195 secs = (86400 * secs.days) + secs.seconds 196 197 if secs == 0: 198 198 cptools.response_headers([("Pragma", "no-cache")], force) 199 199 if cherrypy.request.version >= (1, 1): 200 200 cptools.response_headers([("Cache-Control", "no-cache")], force) 201 202 # Set after Pragma, Cache-Control so it doesn't interfere with 'indicators'203 cptools.response_headers([("Expires", expiry)], force)201 202 expiry = http.HTTPDate(cherrypy.response.time + secs) 203 cptools.response_headers([("Expires", expiry)], force)

