comparison MoinMoin/action/sisterpages.py @ 4183:fc20a076aad0

Accomodate for consolidation of Request/Response
author Florian Krupicka <florian.krupicka@googlemail.com>
date Sat, 21 Jun 2008 16:57:20 +0200
parents 85884c67228d
children 7add275cf4de
comparison
equal deleted inserted replaced
4182:ca0cf44dab89 4183:fc20a076aad0
30 # for 304, we look at if-modified-since and if-none-match headers, 30 # for 304, we look at if-modified-since and if-none-match headers,
31 # one of them must match and the other is either not there or must match. 31 # one of them must match and the other is either not there or must match.
32 if request.if_modified_since == timestamp: 32 if request.if_modified_since == timestamp:
33 if request.if_none_match: 33 if request.if_none_match:
34 if request.if_none_match == etag: 34 if request.if_none_match == etag:
35 request.response.status_code = 304 35 request.status_code = 304
36 else: 36 else:
37 request.response.status_code = 304 37 request.status_code = 304
38 elif request.if_none_match == etag: 38 elif request.if_none_match == etag:
39 if request.if_modified_since: 39 if request.if_modified_since:
40 if request.if_modified_since == timestamp: 40 if request.if_modified_since == timestamp:
41 request.response.status_code = 304 41 request.status_code = 304
42 else: 42 else:
43 request.response.status_code = 304 43 request.status_code = 304
44 else: 44 else:
45 # generate an Expires header, using 1d cache lifetime of sisterpages list 45 # generate an Expires header, using 1d cache lifetime of sisterpages list
46 expires = time.time() + 24*3600 46 expires = time.time() + 24*3600
47 47
48 request.response.mime_type = 'text/plain' 48 request.mime_type = 'text/plain'
49 request.response.expires = expires 49 request.expires = expires
50 request.response.last_modified = timestamp 50 request.last_modified = timestamp
51 request.response.headers.add("Etag", etag) 51 request.headers.add("Etag", etag)
52 52
53 # send the generated XML document 53 # send the generated XML document
54 baseurl = request.getBaseURL() 54 baseurl = request.getBaseURL()
55 if not baseurl.endswith('/'): 55 if not baseurl.endswith('/'):
56 baseurl += '/' 56 baseurl += '/'