Back to index

moin  1.9.0~rc2
titleindex.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - "titleindex" action
00004 
00005     This action generates a plain list of pages, so that other wikis
00006     can implement http://www.usemod.com/cgi-bin/mb.pl?MetaWiki more
00007     easily.
00008 
00009     @copyright: 2001 Juergen Hermann <jh@web.de>
00010     @license: GNU GPL, see COPYING for details.
00011 """
00012 
00013 from MoinMoin import config, util
00014 
00015 
00016 def execute(pagename, request):
00017     # get the MIME type
00018     mimetype = request.values.get('mimetype', "text/plain")
00019     request.mimetype = mimetype
00020 
00021     # Get list of user readable pages
00022     pages = request.rootpage.getPageList()
00023     pages.sort()
00024 
00025     if mimetype == "text/xml":
00026         request.write('<?xml version="1.0" encoding="%s"?>\r\n' % (config.charset, ))
00027         request.write('<TitleIndex>\r\n')
00028         for name in pages:
00029             request.write('  <Title>%s</Title>\r\n' % (util.TranslateCDATA(name), ))
00030         request.write('</TitleIndex>\r\n')
00031     else:
00032         for name in pages:
00033             request.write(name+'\r\n')
00034