simpler last_modified implementation stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 02 Feb 2010 10:47:47 +0100
branchstable
changeset 4423 c1850ef961fc
parent 4422 c0f41f53f1c3
child 4424 5a5cd7591706
simpler last_modified implementation
web/httpcache.py
--- a/web/httpcache.py	Mon Feb 01 18:55:47 2010 +0100
+++ b/web/httpcache.py	Tue Feb 02 10:47:47 2010 +0100
@@ -111,14 +111,10 @@
         mtime = self.req.header_if_modified_since()
         if mtime:
             tdelta = (ctime - mtime)
-            if tdelta.days * 24*60*60 + tdelta.seconds > self.cache_max_age:
-                mtime = ctime
-        else:
-            mtime = ctime
-    else:
-        mtime = ctime
+            if tdelta.days * 24*60*60 + tdelta.seconds <= self.cache_max_age:
+                return mtime
     # mtime = ctime will force page rerendering
-    return mtime
+    return ctime
 viewmod.View.last_modified = last_modified
 
 # configure default caching