changeset 3876:6b9d964c70dc

cache action: respond with 404 if cache key is not found or other CacheError happens
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 19 Jul 2008 14:10:15 +0200
parents 3b1ab037ec09
children f042906b346e 0347889df050
files MoinMoin/action/cache.py
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/action/cache.py	Sat Jul 19 13:43:51 2008 +0200
+++ b/MoinMoin/action/cache.py	Sat Jul 19 14:10:15 2008 +0200
@@ -210,12 +210,16 @@
 
 def _do_get(request, key):
     """ send a complete http response with headers/data cached for key """
-    last_modified, headers = _get_headers(request, key)
-    if request.if_modified_since == last_modified:
-        request.emit_http_headers(["Status: 304 Not modified"])
-    else:
-        request.emit_http_headers(headers)
-        request.send_file(_get_datafile(request, key))
+    try:
+        last_modified, headers = _get_headers(request, key)
+        if request.if_modified_since == last_modified:
+            request.emit_http_headers(["Status: 304 Not modified"])
+        else:
+            data_file = _get_datafile(request, key)
+            request.emit_http_headers(headers)
+            request.send_file(data_file)
+    except caching.CacheError:
+        request.emit_http_headers(["Status: 404 Not found"])
 
 
 def _do_remove(request, key):