comparison 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
comparison
equal deleted inserted replaced
5590:60f0768f0bcf 5591:1dff6cfdcf90
217 try: 217 try:
218 last_modified, headers = _get_headers(request, key) 218 last_modified, headers = _get_headers(request, key)
219 if request.if_modified_since == last_modified: 219 if request.if_modified_since == last_modified:
220 request.status_code = 304 220 request.status_code = 304
221 else: 221 else:
222 for k, v in headers:
223 request.headers.add(k, v)
222 data_file = _get_datafile(request, key) 224 data_file = _get_datafile(request, key)
223 for key, value in headers:
224 lkey = key.lower()
225 if lkey == 'content-type':
226 request.content_type = value
227 elif lkey == 'last-modified':
228 request.last_modified = value
229 elif lkey == 'content-length':
230 request.content_length = value
231 else:
232 request.headers.add(key, value)
233 request.send_file(data_file) 225 request.send_file(data_file)
234 except caching.CacheError: 226 except caching.CacheError:
235 request.status_code = 404 227 request.status_code = 404
236 228
237 229