changeset 5945:d73431c6d2c9

fix 304 http status for cache action, see MoinMoinBugs/CacheActionComparesTimestampsIncorrectly
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 28 Feb 2013 15:48:49 +0100
parents 82ad863c255e
children 8f518bc5258b
files MoinMoin/action/cache.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/cache.py	Sat Feb 23 18:28:30 2013 +0100
+++ b/MoinMoin/action/cache.py	Thu Feb 28 15:48:49 2013 +0100
@@ -27,6 +27,8 @@
     @license: GNU GPL, see COPYING for details.
 """
 
+from datetime import datetime
+
 from MoinMoin import log
 logging = log.getLogger(__name__)
 
@@ -202,7 +204,7 @@
     """ get last_modified and headers cached for key """
     meta_cache = caching.CacheEntry(request, cache_arena, key+'.meta', cache_scope, do_locking=do_locking, use_pickle=True)
     meta = meta_cache.content()
-    return meta['httpdate_last_modified'], meta['headers']
+    return meta['last_modified'], meta['headers']
 
 
 def _get_datafile(request, key):
@@ -216,7 +218,7 @@
     """ send a complete http response with headers/data cached for key """
     try:
         last_modified, headers = _get_headers(request, key)
-        if request.if_modified_since == last_modified:
+        if datetime.utcfromtimestamp(int(last_modified)) == request.if_modified_since:
             request.status_code = 304
         else:
             for k, v in headers: