Back to index

moin  1.9.0~rc2
Functions
MoinMoin.action.sisterpages Namespace Reference

Functions

def execute

Function Documentation

def MoinMoin.action.sisterpages.execute (   pagename,
  request 
)

Definition at line 20 of file sisterpages.py.

00020 
00021 def execute(pagename, request):
00022     log = editlog.EditLog(request)
00023     try:
00024         lastmod = wikiutil.version2timestamp(log.date())
00025     except:
00026         lastmod = 0
00027 
00028     timestamp = timefuncs.formathttpdate(lastmod)
00029     etag = "%d" % lastmod
00030 
00031     # for 304, we look at if-modified-since and if-none-match headers,
00032     # one of them must match and the other is either not there or must match.
00033     if request.if_modified_since == timestamp:
00034         if request.if_none_match:
00035             if request.if_none_match == etag:
00036                 request.status_code = 304
00037         else:
00038             request.status_code = 304
00039     elif request.if_none_match == etag:
00040         if request.if_modified_since:
00041             if request.if_modified_since == timestamp:
00042                 request.status_code = 304
00043         else:
00044             request.status_code = 304
00045     else:
00046         # generate an Expires header, using 1d cache lifetime of sisterpages list
00047         expires = time.time() + 24*3600
00048 
00049         request.mime_type = 'text/plain'
00050         request.expires = expires
00051         request.last_modified = timestamp
00052         request.headers.add("Etag", etag)
00053 
00054         # send the generated XML document
00055         # Get list of user readable pages
00056         pages = request.rootpage.getPageList()
00057         pages.sort()
00058         for pn in pages:
00059             p = Page(request, pn)
00060             entry = u"%s %s\r\n" % (request.getQualifiedURL(p.url(request)), p.page_name)
00061             request.write(entry.encode('utf-8'))