# HG changeset patch # User Sylvain Thénault # Date 1278074854 -7200 # Node ID 7ef636d24ab2643b17120af756d1d14ce35f852b # Parent e676a869a3e929aceccdb14e48593c802460e60c cleanup diff -r e676a869a3e9 -r 7ef636d24ab2 etwist/request.py --- a/etwist/request.py Fri Jul 02 14:47:12 2010 +0200 +++ b/etwist/request.py Fri Jul 02 14:47:34 2010 +0200 @@ -83,32 +83,22 @@ # Expires header seems to be required by IE7 self.add_header('Expires', 'Sat, 01 Jan 2000 00:00:00 GMT') return - # when using both 'Last-Modified' and 'ETag' response headers # (i.e. using respectively If-Modified-Since and If-None-Match request # headers, see # http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.3.4 for # reference - - cached_because_not_modified_since = False - last_modified = self.headers_out.getHeader('last-modified') if last_modified is not None: - cached_because_not_modified_since = (self._twreq.setLastModified(last_modified) - == http.CACHED) - - if not cached_because_not_modified_since: - return - - cached_because_etag_is_same = False + status = self._twreq.setLastModified(last_modified) + if status != http.CACHED: + return etag = self.headers_out.getRawHeaders('etag') if etag is not None: - cached_because_etag_is_same = self._twreq.setETag(etag[0]) == http.CACHED - - if cached_because_etag_is_same: - response = not_modified_response(self._twreq, self._headers_in) - raise DirectResponse(response) - + status = self._twreq.setETag(etag[0]) + if status == http.CACHED: + response = not_modified_response(self._twreq, self._headers_in) + raise DirectResponse(response) # Expires header seems to be required by IE7 self.add_header('Expires', 'Sat, 01 Jan 2000 00:00:00 GMT') diff -r e676a869a3e9 -r 7ef636d24ab2 web/httpcache.py --- a/web/httpcache.py Fri Jul 02 14:47:12 2010 +0200 +++ b/web/httpcache.py Fri Jul 02 14:47:34 2010 +0200 @@ -15,10 +15,8 @@ # # You should have received a copy of the GNU Lesser General Public License along # with CubicWeb. If not, see . -"""HTTP cache managers +"""HTTP cache managers""" - -""" __docformat__ = "restructuredtext en" from time import mktime