diff MoinMoin/action/cache.py @ 5591:1dff6cfdcf90

http headers: for most cases, do not use .add, but .__setitem__
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 27 Feb 2010 02:04:17 +0100
parents ace3bbadf66d
children d73431c6d2c9
line wrap: on
line diff
--- a/MoinMoin/action/cache.py	Fri Feb 26 10:32:03 2010 +0100
+++ b/MoinMoin/action/cache.py	Sat Feb 27 02:04:17 2010 +0100
@@ -219,17 +219,9 @@
         if request.if_modified_since == last_modified:
             request.status_code = 304
         else:
+            for k, v in headers:
+                request.headers.add(k, v)
             data_file = _get_datafile(request, key)
-            for key, value in headers:
-                lkey = key.lower()
-                if lkey == 'content-type':
-                    request.content_type = value
-                elif lkey == 'last-modified':
-                    request.last_modified = value
-                elif lkey == 'content-length':
-                    request.content_length = value
-                else:
-                    request.headers.add(key, value)
             request.send_file(data_file)
     except caching.CacheError:
         request.status_code = 404